|
|
1.1 ! root 1: /* baduser.c - check file of bad users */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/compat/RCS/baduser.c,v 7.0 89/11/23 21:22:54 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/compat/RCS/baduser.c,v 7.0 89/11/23 21:22:54 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: baduser.c,v $ ! 12: * Revision 7.0 89/11/23 21:22:54 mrose ! 13: * Release 6.0 ! 14: * ! 15: */ ! 16: ! 17: /* ! 18: * NOTICE ! 19: * ! 20: * Acquisition, use, and distribution of this module and related ! 21: * materials are subject to the restrictions of a license agreement. ! 22: * Consult the Preface in the User's Manual for the full terms of ! 23: * this agreement. ! 24: * ! 25: */ ! 26: ! 27: ! 28: /* LINTLIBRARY */ ! 29: ! 30: #include <stdio.h> ! 31: #include "general.h" ! 32: #include "manifest.h" ! 33: #include "tailor.h" ! 34: ! 35: /* */ ! 36: ! 37: int baduser (file, user) ! 38: char *file, ! 39: *user; ! 40: { ! 41: int hit, ! 42: tries; ! 43: register char *bp; ! 44: char buffer[BUFSIZ]; ! 45: FILE *fp; ! 46: ! 47: hit = 0; ! 48: for (tries = 0; tries < 2 && !hit; tries++) { ! 49: switch (tries) { ! 50: case 0: ! 51: if (file) { ! 52: bp = isodefile (file, 0); ! 53: break; ! 54: } ! 55: tries++; ! 56: /* and fall */ ! 57: default: ! 58: bp = "/etc/ftpusers"; ! 59: break; ! 60: } ! 61: if ((fp = fopen (bp, "r")) == NULL) ! 62: continue; ! 63: ! 64: while (fgets (buffer, sizeof buffer, fp)) { ! 65: if (bp = index (buffer, '\n')) ! 66: *bp = NULL; ! 67: if (strcmp (buffer, user) == 0) { ! 68: hit++; ! 69: break; ! 70: } ! 71: } ! 72: ! 73: (void) fclose (fp); ! 74: } ! 75: ! 76: ! 77: return hit; ! 78: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.