diff options
author | jkar8572 <jkar8572> | 2002-07-23 15:59:27 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2002-07-23 15:59:27 +0000 |
commit | 8e0302ea1b0d327c66839ad738d2d5271e25f4d7 (patch) | |
tree | 544a35abe5b1978eeed817f964bfb82a0db3c89a /quotasys.c | |
parent | 2d1fc29bbe752b590d9f320df80913c3808f7545 (diff) |
* fixed quotacheck(8) to continue when old quota files were not found (Jan Kara)
* quota(1) now doesn't report failure to connect to rpc.rquotad server when -Q specified (Jan Kara)
* add quota(1) option -l (report only local filesystems) (Jan Kara)
* warnquota(8) now also mails specified member of the group about violation of the group quotas
when -g option is specified (Jan Kara)
* added options by which user can specify whether repquota(8) should translate names in
big chunks by scanning all users or individually. Added automagic detection using nsswitch.conf
which behaviour should lead to faster translating. (Jan Kara)
Diffstat (limited to 'quotasys.c')
-rw-r--r-- | quotasys.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -16,6 +16,7 @@ #include <unistd.h> #include <fcntl.h> #include <signal.h> +#include <ctype.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/vfs.h> @@ -146,6 +147,33 @@ int id2name(int id, int qtype, char *buf) } /* + * Parse /etc/nsswitch.conf and return type of default passwd handling + */ +int passwd_handling(void) +{ + FILE *f; + char buf[1024], *colpos, *spcpos; + int ret = PASSWD_FILES; + + if (!(f = fopen("/etc/nsswitch.conf", "r"))) + return PASSWD_FILES; /* Can't open nsswitch.conf - fallback on compatible mode */ + while (fgets(buf, sizeof(buf), f)) { + if (strncmp(buf, "passwd:", 7)) /* Not passwd entry? */ + continue; + for (colpos = buf+7; isspace(*colpos); colpos++); + if (!*colpos) /* Not found any type of handling? */ + break; + for (spcpos = colpos; !isspace(*spcpos) && *spcpos; spcpos++); + *spcpos = 0; + if (!strcmp(colpos, "db") || !strcmp(colpos, "nis") || !strcmp(colpos, "nis+")) + ret = PASSWD_DB; + break; + } + fclose(f); + return ret; +} + +/* * Convert quota format name to number */ int name2fmt(char *str) |