authcmdlib.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #pragma lib "./lib.$O.a"
  10. enum{
  11. PASSLEN = 10,
  12. MAXNETCHAL = 100000, /* max securenet challenge */
  13. Maxpath = 256,
  14. };
  15. #define KEYDB "/mnt/keys"
  16. #define NETKEYDB "/mnt/netkeys"
  17. #define KEYDBBUF (sizeof NETKEYDB) /* enough for any keydb prefix */
  18. #define AUTHLOG "auth"
  19. enum
  20. {
  21. Nemail = 10,
  22. Plan9 = 1,
  23. Securenet = 2,
  24. };
  25. typedef struct
  26. {
  27. char *user;
  28. char *postid;
  29. char *name;
  30. char *dept;
  31. char *email[Nemail];
  32. } Acctbio;
  33. typedef struct {
  34. char *keys;
  35. char *msg;
  36. char *who;
  37. Biobuf *b;
  38. } Fs;
  39. extern Fs fs[3];
  40. void checksum(char*, char*);
  41. void error(char*, ...);
  42. void fail(char*);
  43. char* findkey(char*, char*, char*);
  44. char* findsecret(char*, char*, char*);
  45. int getauthkey(char*);
  46. int32_t getexpiration(char *db, char *u);
  47. void getpass(char*, char*, int, int);
  48. int getsecret(int, char*);
  49. int keyfmt(Fmt*);
  50. void logfail(char*);
  51. int netcheck(void*, int32_t, char*);
  52. char* netdecimal(char*);
  53. char* netresp(char*, int32_t, char*);
  54. char* okpasswd(char*);
  55. int querybio(char*, char*, Acctbio*);
  56. void rdbio(char*, char*, Acctbio*);
  57. int readarg(int, char*, int);
  58. int readfile(char*, char*, int);
  59. void readln(char*, char*, int, int);
  60. int32_t readn(int, void*, int32_t);
  61. char* secureidcheck(char*, char*);
  62. char* setkey(char*, char*, char*);
  63. char* setsecret(char*, char*, char*);
  64. int smartcheck(void*, int32_t, char*);
  65. void succeed(char*);
  66. void wrbio(char*, Acctbio*);
  67. int writefile(char*, char*, int);
  68. #pragma varargck type "K" char*