Date: Tue, 4 Nov 2008 13:49:18 +0000 (UTC) From: Dag-Erling Smorgrav <des@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r184632 - projects/quota64/lib/libutil Message-ID: <200811041349.mA4DnIOd098202@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: des Date: Tue Nov 4 13:49:18 2008 New Revision: 184632 URL: http://svn.freebsd.org/changeset/base/184632 Log: Committed to wrong branch. Modified: projects/quota64/lib/libutil/login_cap.c projects/quota64/lib/libutil/login_class.c Modified: projects/quota64/lib/libutil/login_cap.c ============================================================================== --- projects/quota64/lib/libutil/login_cap.c Tue Nov 4 13:44:43 2008 (r184631) +++ projects/quota64/lib/libutil/login_cap.c Tue Nov 4 13:49:18 2008 (r184632) @@ -61,8 +61,6 @@ static char * internal_string = NULL; static size_t internal_arraysz = 0; static const char ** internal_array = NULL; -static char path_login_conf[] = _PATH_LOGIN_CONF; - static char * allocstr(const char *str) { @@ -217,14 +215,15 @@ login_getclassbyname(char const *name, c if (dir && snprintf(userpath, MAXPATHLEN, "%s/%s", dir, _FILE_LOGIN_CONF) < MAXPATHLEN) { + login_dbarray[i] = userpath; if (_secure_path(userpath, pwd->pw_uid, pwd->pw_gid) != -1) - login_dbarray[i++] = userpath; + i++; /* only use 'secure' data */ } /* * XXX: Why to add the system database if the class is `me'? */ - if (_secure_path(path_login_conf, 0, 0) != -1) - login_dbarray[i++] = path_login_conf; + if (_secure_path(_PATH_LOGIN_CONF, 0, 0) != -1) + login_dbarray[i++] = _PATH_LOGIN_CONF; login_dbarray[i] = NULL; memset(lc, 0, sizeof(login_cap_t)); Modified: projects/quota64/lib/libutil/login_class.c ============================================================================== --- projects/quota64/lib/libutil/login_class.c Tue Nov 4 13:44:43 2008 (r184631) +++ projects/quota64/lib/libutil/login_class.c Tue Nov 4 13:49:18 2008 (r184632) @@ -142,13 +142,14 @@ substvar(const char * var, const struct int tildes = 0; int dollas = 0; char *p; - const char *q; if (pwd != NULL) { - for (q = var; *q != '\0'; ++q) { - tildes += (*q == '~'); - dollas += (*q == '$'); - } + /* Count the number of ~'s in var to substitute */ + for (p = (char *)var; (p = strchr(p, '~')) != NULL; p++) + ++tildes; + /* Count the number of $'s in var to substitute */ + for (p = (char *)var; (p = strchr(p, '$')) != NULL; p++) + ++dollas; } np = malloc(strlen(var) + (dollas * nlen)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811041349.mA4DnIOd098202>