comparison auth.h @ 33:f789045062e6

Progressing client support
author Matt Johnston <matt@ucc.asn.au>
date Tue, 27 Jul 2004 16:30:46 +0000
parents fe6bca95afa7
children 942b22d7dd1c
comparison
equal deleted inserted replaced
32:8fd0cdbb5b1b 33:f789045062e6
25 #ifndef _AUTH_H_ 25 #ifndef _AUTH_H_
26 #define _AUTH_H_ 26 #define _AUTH_H_
27 27
28 #include "includes.h" 28 #include "includes.h"
29 29
30 void authinitialise(); 30 void svr_authinitialise();
31 void cli_authinitialise();
31 32
33 void svr_auth_password();
34 void svr_auth_pubkey();
35
36 int cli_auth_password();
37 int cli_auth_pubkey();
38
39 /* Server functions */
32 void recv_msg_userauth_request(); 40 void recv_msg_userauth_request();
33 void send_msg_userauth_failure(int partial, int incrfail); 41 void send_msg_userauth_failure(int partial, int incrfail);
34 void send_msg_userauth_success(); 42 void send_msg_userauth_success();
43
44 /* Client functions */
45 void recv_msg_userauth_failure();
46 void recv_msg_userauth_success();
47 void cli_get_user();
48 void cli_auth_getmethods();
49 void cli_auth_try();
50
35 51
36 #define MAX_USERNAME_LEN 25 /* arbitrary for the moment */ 52 #define MAX_USERNAME_LEN 25 /* arbitrary for the moment */
37 53
38 #define AUTH_TYPE_PUBKEY 1 << 0 54 #define AUTH_TYPE_PUBKEY 1 << 0
39 #define AUTH_TYPE_PASSWORD 1 << 1 55 #define AUTH_TYPE_PASSWORD 1 << 1
44 #define AUTH_METHOD_PUBKEY "publickey" 60 #define AUTH_METHOD_PUBKEY "publickey"
45 #define AUTH_METHOD_PUBKEY_LEN 9 61 #define AUTH_METHOD_PUBKEY_LEN 9
46 #define AUTH_METHOD_PASSWORD "password" 62 #define AUTH_METHOD_PASSWORD "password"
47 #define AUTH_METHOD_PASSWORD_LEN 8 63 #define AUTH_METHOD_PASSWORD_LEN 8
48 64
65 /* This structure is shared between server and client - it contains
66 * relatively little extraneous bits when used for the client rather than the
67 * server */
49 struct AuthState { 68 struct AuthState {
50 69
51 char *username; /* This is the username the client presents to check. It 70 char *username; /* This is the username the client presents to check. It
52 is updated each run through, used for auth checking */ 71 is updated each run through, used for auth checking */
53 char *printableuser; /* stripped of control chars, used for logs etc */
54 struct passwd * pw;
55 unsigned char authtypes; /* Flags indicating which auth types are still 72 unsigned char authtypes; /* Flags indicating which auth types are still
56 valid */ 73 valid */
57 unsigned int failcount; /* Number of (failed) authentication attempts.*/ 74 unsigned int failcount; /* Number of (failed) authentication attempts.*/
58 unsigned authdone : 1; /* 0 if we haven't authed, 1 if we have */ 75 unsigned authdone : 1; /* 0 if we haven't authed, 1 if we have. Applies for
76 client and server (though has differing [obvious]
77 meanings). */
59 78
79 /* These are only used for the server */
80 char *printableuser; /* stripped of control chars, used for logs etc */
81 struct passwd * pw;
60 82
61 }; 83 };
62 84
63 #endif /* _AUTH_H_ */ 85 #endif /* _AUTH_H_ */