authcmdlib.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. enum{
  10. PASSLEN = 10,
  11. MAXNETCHAL = 100000, /* max securenet challenge */
  12. Maxpath = 256,
  13. };
  14. #define KEYDB "/mnt/keys"
  15. #define NETKEYDB "/mnt/netkeys"
  16. #define KEYDBBUF (sizeof NETKEYDB) /* enough for any keydb prefix */
  17. #define AUTHLOG "auth"
  18. enum
  19. {
  20. Nemail = 10,
  21. Plan9 = 1,
  22. Securenet = 2,
  23. };
  24. typedef struct
  25. {
  26. char *user;
  27. char *postid;
  28. char *name;
  29. char *dept;
  30. char *email[Nemail];
  31. } Acctbio;
  32. typedef struct {
  33. char *keys;
  34. char *msg;
  35. char *who;
  36. Biobuf *b;
  37. } Fs;
  38. extern Fs fs[3];
  39. void checksum(char*, char*);
  40. void error(char*, ...);
  41. void fail(char*);
  42. char* findkey(char*, char*, char*);
  43. char* findsecret(char*, char*, char*);
  44. int getauthkey(char*);
  45. int32_t getexpiration(char *db, char *u);
  46. void getpass(char*, char*, int, int);
  47. int getsecret(int, char*);
  48. int keyfmt(Fmt*);
  49. void logfail(char*);
  50. int netcheck(void*, int32_t, char*);
  51. char* netdecimal(char*);
  52. char* netresp(char*, int32_t, char*);
  53. char* okpasswd(char*);
  54. int querybio(char*, char*, Acctbio*);
  55. void rdbio(char*, char*, Acctbio*);
  56. int readarg(int, char*, int);
  57. int readfile(char*, char*, int);
  58. void readln(char*, char*, int, int);
  59. int32_t readn(int, void*, int32_t);
  60. char* secureidcheck(char*, char*);
  61. char* setkey(char*, char*, char*);
  62. char* setsecret(char*, char*, char*);
  63. int smartcheck(void*, int32_t, char*);
  64. void succeed(char*);
  65. void wrbio(char*, Acctbio*);
  66. int writefile(char*, char*, int);