Changeset 579 for server/common
- Timestamp:
- Jan 5, 2008, 5:47:19 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/common/oursrc/accountadm/admof.c
r578 r579 26 26 #include <krb5.h> 27 27 #include <kerberosIV/krb.h> 28 #include <stdbool.h> 28 29 29 30 extern int pioctl(char *, afs_int32, struct ViceIoctl *, afs_int32); … … 35 36 #define OVERLORDS "system:scripts-root" 36 37 37 static int38 static bool 38 39 ismember(const char *user, const char *group) 39 40 { … … 88 89 if (n < 0 || n >= sizeof dir) 89 90 die("internal error\n"); 91 92 /* For non-AFS homedirs, read the .k5login file. */ 93 if (strncmp(dir, "/afs/", 5) != 0 && strncmp(dir, "/mit/", 5) != 0) { 94 if (chdir(dir) != 0) 95 die("internal error: chdir: %m\n"); 96 FILE *fp = fopen(".k5login", "r"); 97 if (fp == NULL) 98 die("internal error: .k5login: %m\n"); 99 bool found = false; 100 char *line = NULL; 101 size_t len = 0; 102 ssize_t read; 103 while ((read = getline(&line, &len, fp)) != -1) { 104 if (read > 0 && line[read - 1] == '\n') 105 line[read - 1] = '\0'; 106 if (strcmp(name, line) == 0) { 107 found = true; 108 break; 109 } 110 } 111 if (line) 112 free(line); 113 fclose(fp); 114 if (found) { 115 printf("yes\n"); 116 exit(33); 117 } else { 118 printf("no\n"); 119 exit(1); 120 } 121 } 90 122 91 123 /* Get the locker's cell. */
Note: See TracChangeset
for help on using the changeset viewer.