waffle

user and group backend daemon
git clone git://git.2f30.org/waffle
Log | Files | Refs | LICENSE

commit ac983788ff8cf47de6e2379ec07eb03db6982a0d
parent b39751498ad3ec5727559e33c3fa0d541bc21025
Author: sin <sin@2f30.org>
Date:   Sat,  7 Mar 2015 17:59:59 +0000

Rename pwd -> pw

Diffstat:
Mreq.c | 44++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/req.c b/req.c @@ -43,7 +43,7 @@ handle_req(int clifd) } static int -replypwd(int clifd, struct passwd *pwd) +replypw(int clifd, struct passwd *pw) { struct nscdpasswd header; char *buf; @@ -51,14 +51,14 @@ replypwd(int clifd, struct passwd *pwd) ssize_t n; header.version = NSCDVERSION; - header.found = pwd ? 1 : 0; - header.namelen = pwd ? strlen(pwd->pw_name) + 1 : 0; - header.passwdlen = pwd ? strlen(pwd->pw_passwd) + 1 : 0; - header.uid = pwd ? pwd->pw_uid : -1; - header.gid = pwd ? pwd->pw_gid : -1; - header.gecoslen = pwd ? strlen(pwd->pw_gecos) + 1 : 0; - header.dirlen = pwd ? strlen(pwd->pw_dir) + 1 : 0; - header.shelllen = pwd ? strlen(pwd->pw_shell) + 1 : 0; + header.found = pw ? 1 : 0; + header.namelen = pw ? strlen(pw->pw_name) + 1 : 0; + header.passwdlen = pw ? strlen(pw->pw_passwd) + 1 : 0; + header.uid = pw ? pw->pw_uid : -1; + header.gid = pw ? pw->pw_gid : -1; + header.gecoslen = pw ? strlen(pw->pw_gecos) + 1 : 0; + header.dirlen = pw ? strlen(pw->pw_dir) + 1 : 0; + header.shelllen = pw ? strlen(pw->pw_shell) + 1 : 0; len = sizeof(header) + header.namelen + @@ -71,25 +71,25 @@ replypwd(int clifd, struct passwd *pwd) if (!buf) return -1; - if (!pwd) { + if (!pw) { memcpy(buf, &header, sizeof(header)); } else { memcpy(buf, &header, sizeof(header)); offset = sizeof(header); - memcpy(buf + offset, pwd->pw_name, header.namelen); + memcpy(buf + offset, pw->pw_name, header.namelen); offset += header.namelen; - memcpy(buf + offset, pwd->pw_passwd, header.passwdlen); + memcpy(buf + offset, pw->pw_passwd, header.passwdlen); offset += header.passwdlen; - memcpy(buf + offset, pwd->pw_gecos, header.gecoslen); + memcpy(buf + offset, pw->pw_gecos, header.gecoslen); offset += header.gecoslen; - memcpy(buf + offset, pwd->pw_dir, header.dirlen); + memcpy(buf + offset, pw->pw_dir, header.dirlen); offset += header.dirlen; - memcpy(buf + offset, pwd->pw_shell, header.shelllen); + memcpy(buf + offset, pw->pw_shell, header.shelllen); } n = write(clifd, buf, len); @@ -161,20 +161,20 @@ replygr(int clifd, struct group *gr) int process_req(int clifd, struct nscdreq *req, char *key) { - struct passwd pwd; + struct passwd pw; struct group gr; switch (req->type) { case GETPWBYNAME: - if (!backends_pwbyname(key, &pwd)) - return replypwd(clifd, &pwd); + if (!backends_pwbyname(key, &pw)) + return replypw(clifd, &pw); else - return replypwd(clifd, NULL); + return replypw(clifd, NULL); case GETPWBYUID: - if (!backends_pwbyuid(key, &pwd)) - return replypwd(clifd, &pwd); + if (!backends_pwbyuid(key, &pw)) + return replypw(clifd, &pw); else - return replypwd(clifd, NULL); + return replypw(clifd, NULL); case GETGRBYNAME: if (!backends_grbyname(key, &gr)) return replygr(clifd, &gr);