X-Git-Url: http://git.jankratochvil.net/?p=tac_plus.git;a=blobdiff_plain;f=choose_authen.h;fp=choose_authen.h;h=12764949df4fb6d5e82d18393dd87c632caa7f7e;hp=0000000000000000000000000000000000000000;hb=413c510553a773cd16e2b538e4a208b4c4d9f775;hpb=a296ccf128acec69a7db2312ebcc231cd18e5944 diff --git a/choose_authen.h b/choose_authen.h new file mode 100644 index 0000000..1276494 --- /dev/null +++ b/choose_authen.h @@ -0,0 +1,63 @@ +#ifndef CHOOSE_AUTHEN_H +#define CHOOSE_AUTHEN_H 1 + +#include "tac_plus.h" + +#include /* for u_* */ + + +/* + * This structure describes an authentication method. + * authen_name contains the name of the authentication method. + * authen_func is a pointer to the authentication function. + * authen_method numeric value of authentication method + */ + +#define AUTHEN_NAME_SIZE 128 + +struct authen_data; + +struct authen_type { + char authen_name[AUTHEN_NAME_SIZE]; + int (*authen_func) TAC_ARGS((struct authen_data *data)); + int authen_type; +}; + +/* + * The authen_data structure is the data structure for passing + * information to and from the authentication function + * (authen_type.authen_func). + */ + +struct authen_data { + struct identity *NAS_id; /* user identity */ + char *server_msg; /* null-terminated output msg */ + + int server_dlen; /* output data length */ + unsigned char *server_data; /* output data */ + + char *client_msg; /* null-terminated input msg a user typed */ + + int client_dlen; /* input data length */ + char *client_data; /* input data */ + + void *method_data; /* opaque private method data */ + int action; /* what's to be done */ + int service; /* calling service */ + int status; /* Authen status */ + int type; /* Authen type */ + u_char flags; /* input & output flags fields */ +}; + +/* return values for choose_authen(); */ + +#define CHOOSE_FAILED -1 /* failed to choose an authentication function */ +#define CHOOSE_OK 0 /* successfully chose an authentication function */ +#define CHOOSE_GETUSER 1 /* need a username before choosing */ +#define CHOOSE_BADTYPE 2 /* Invalid preferred authen function specified */ + + +extern int choose_authen TAC_ARGS((struct authen_data *data, struct authen_type *type)); + + +#endif /* CHOOSE_AUTHEN_H */