File: passwords.h

package info (click to toggle)
avfs 1.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,916 kB
  • sloc: ansic: 31,364; sh: 6,482; perl: 1,916; makefile: 351
file content (52 lines) | stat: -rw-r--r-- 1,606 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
    AVFS: A Virtual File System Library
    Copyright (C) 2000-2001  Miklos Szeredi <miklos@szeredi.hu>

    This program can be distributed under the terms of the GNU GPL.
    See the file COPYING.
*/

#ifndef INCLUDED_PASSWORDS_H
#define INCLUDED_PASSWORDS_H 1

#include "avfs.h"
#include "state.h"

#define USER_SEP_STR  "@"
#define USER_SEP_CHAR (USER_SEP_STR[0])

/**
 * Note: FTP uses "user@host" or just "user@" for the account key,
 * since the username is passed in as part of the path. In the FTP
 * case the "username" member in this struct can be left NULL.
 * 
 * HTTP/DAV uses "realm@host" or just "@host", and stores the username
 * as well as the password in this struct.
 */
struct pass_session {
    char *account;
    char *username;
    char *password;
    struct pass_session *next;
    struct pass_session *prev;
};

/* these two are only needed for HTTP (see comment above) */
extern int pass_username_get(struct entry *ent, const char *param, char **resp);

extern int pass_username_set(struct entry *ent, const char *param, const char *val);

extern int pass_password_get(struct entry *ent, const char *param, char **resp);

extern int pass_password_set(struct entry *ent, const char *param, const char *val);

extern int pass_loggedin_get(struct entry *ent, const char *param, char **resp);

extern int pass_loggedin_set(struct entry *ent, const char *param, const char *val);

struct pass_session *pass_get_password(struct pass_session *passd,
    			const char *host, const char *user);

void pass_remove_session(struct pass_session *fts);

#endif /* INCLUDED_PASSWORDS_H */