"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/modules/passwd.c" between
userinfo-2.4.tar.gz and userinfo-2.5.tar.gz

About: userinfo is a console utility to display a variety of information about a local user.

passwd.c  (userinfo-2.4):passwd.c  (userinfo-2.5)
/* /*
Copyright (C) 2001-2013 Ben Kibbey <bjk@luxsci.net> Copyright (C) 2001-2015 Ben Kibbey <bjk@luxsci.net>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 296 skipping to change at line 296
#endif #endif
strings = *s; strings = *s;
while (*p) { while (*p) {
char tmp[256]; char tmp[256];
switch (*p) { switch (*p) {
#ifdef HAVE_GETSPNAM #ifdef HAVE_GETSPNAM
case 'c': case 'c':
if (!amroot) { if (!amroot || !spwd) {
add_string(&strings, "!"); add_string(&strings, "!");
break; break;
} }
snprintf(tmp, sizeof(tmp), "%li", (long) spwd->sp_max); snprintf(tmp, sizeof(tmp), "%li", (long) spwd->sp_max);
add_string(&strings, tmp); add_string(&strings, tmp);
break; break;
case 'e': case 'e':
if (!amroot) { if (!amroot || !spwd) {
add_string(&strings, "!"); add_string(&strings, "!");
break; break;
} }
snprintf(tmp, sizeof(tmp), "%li", (long) spwd->sp_expire); snprintf(tmp, sizeof(tmp), "%li", (long) spwd->sp_expire);
add_string(&strings, tmp); add_string(&strings, tmp);
break; break;
#else #else
case 'c': case 'c':
#ifdef HAVE_PASSWD_CHANGE #ifdef HAVE_PASSWD_CHANGE
skipping to change at line 345 skipping to change at line 345
add_string(&strings, (pw->pw_dir && pw->pw_dir[0]) ? pw->pw_dir : "-"); add_string(&strings, (pw->pw_dir && pw->pw_dir[0]) ? pw->pw_dir : "-");
break; break;
case 's': case 's':
add_string(&strings, (pw->pw_shell && pw->pw_shell[0]) ? pw->pw_s hell : "-"); add_string(&strings, (pw->pw_shell && pw->pw_shell[0]) ? pw->pw_s hell : "-");
break; break;
case 'p': case 'p':
#ifdef HAVE_GETSPNAM #ifdef HAVE_GETSPNAM
if (!amroot) if (!amroot)
add_string(&strings, (pw->pw_passwd add_string(&strings, (pw->pw_passwd
&& pw->pw_passwd[0]) ? pw->pw_passwd : "-"); && pw->pw_passwd[0]) ? pw->pw_passwd : "-");
else else if (!spwd)
add_string(&strings, "-");
else
add_string(&strings, (spwd->sp_pwdp add_string(&strings, (spwd->sp_pwdp
&& spwd->sp_pwdp[0]) ? spwd->sp_pwdp : "-"); && spwd->sp_pwdp[0]) ? spwd->sp_pwdp : "-");
#else #else
add_string(&strings, (pw->pw_passwd add_string(&strings, (pw->pw_passwd
&& pw->pw_passwd[0]) ? pw->pw_passwd : "-"); && pw->pw_passwd[0]) ? pw->pw_passwd : "-");
#endif #endif
break; break;
case 'u': case 'u':
sprintf(tmp, "%li", (long) pw->pw_uid); sprintf(tmp, "%li", (long) pw->pw_uid);
add_string(&strings, tmp); add_string(&strings, tmp);
break; break;
case 'g': case 'g':
groups(pw, multi_char, verbose); groups(pw, multi_char, verbose);
break; break;
case 'm': case 'm':
if (stat(pw->pw_dir, &st) == -1) { if (!pw->pw_dir || !*pw->pw_dir || stat(pw->pw_dir, &st) == -1) {
add_string(&strings, "!"); add_string(&strings, "!");
break; break;
} }
sprintf(tmp, "%.4o", (unsigned) st.st_mode & ALLPERMS); sprintf(tmp, "%.4o", (unsigned) st.st_mode & ALLPERMS);
add_string(&strings, tmp); add_string(&strings, tmp);
break; break;
case 'i': case 'i':
#ifdef HAVE_PASSWD_GECOS #ifdef HAVE_PASSWD_GECOS
gecos_strings(pw->pw_gecos); gecos_strings(pw->pw_gecos);
 End of changes. 5 change blocks. 
5 lines changed or deleted 7 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS