[Pkg-shadow-commits] r1569 - in upstream/trunk: . src
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Mon Dec 31 13:48:49 UTC 2007
Author: nekral-guest
Date: 2007-12-31 13:48:48 +0000 (Mon, 31 Dec 2007)
New Revision: 1569
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/chfn.c
Log:
Avoid implicit brackets.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2007-12-31 13:43:04 UTC (rev 1568)
+++ upstream/trunk/ChangeLog 2007-12-31 13:48:48 UTC (rev 1569)
@@ -6,6 +6,7 @@
get_old_fields(), and check_fields() split out of main().
* src/chfn.c: Before pam_end(), the return value of the previous
pam API was already checked. No need to validate it again.
+ * src/chfn.c: Avoid implicit brackets.
2007-12-31 Nicolas François <nicolas.francois at centraliens.net>
Modified: upstream/trunk/src/chfn.c
===================================================================
--- upstream/trunk/src/chfn.c 2007-12-31 13:43:04 UTC (rev 1568)
+++ upstream/trunk/src/chfn.c 2007-12-31 13:48:48 UTC (rev 1569)
@@ -92,15 +92,16 @@
*/
static void usage (void)
{
- if (amroot)
+ if (amroot) {
fprintf (stderr,
_("Usage: %s [-f full_name] [-r room_no] "
"[-w work_ph]\n"
"\t[-h home_ph] [-o other] [user]\n"), Prog);
- else
+ } else {
fprintf (stderr,
_("Usage: %s [-f full_name] [-r room_no] "
"[-w work_ph] [-h home_ph]\n"), Prog);
+ }
exit (E_USAGE);
}
@@ -126,17 +127,23 @@
* "no" is equivalent to "frwh". Only root can change anything
* if the string is empty or not defined at all.
*/
- if (amroot)
+ if (amroot) {
return 1;
+ }
+
cp = getdef_str ("CHFN_RESTRICT");
- if (!cp)
+ if (!cp) {
cp = "";
- else if (strcmp (cp, "yes") == 0)
+ } else if (strcmp (cp, "yes") == 0) {
cp = "rwh";
- else if (strcmp (cp, "no") == 0)
+ } else if (strcmp (cp, "no") == 0) {
cp = "frwh";
- if (strchr (cp, field))
+ }
+
+ if (strchr (cp, field)) {
return 1;
+ }
+
return 0;
}
@@ -150,28 +157,33 @@
{
printf (_("Enter the new value, or press ENTER for the default\n"));
- if (may_change_field ('f'))
+ if (may_change_field ('f')) {
change_field (fullnm, sizeof fullnm, _("Full Name"));
- else
+ } else {
printf (_("\tFull Name: %s\n"), fullnm);
+ }
- if (may_change_field ('r'))
+ if (may_change_field ('r')) {
change_field (roomno, sizeof roomno, _("Room Number"));
- else
+ } else {
printf (_("\tRoom Number: %s\n"), roomno);
+ }
- if (may_change_field ('w'))
+ if (may_change_field ('w')) {
change_field (workph, sizeof workph, _("Work Phone"));
- else
+ } else {
printf (_("\tWork Phone: %s\n"), workph);
+ }
- if (may_change_field ('h'))
+ if (may_change_field ('h')) {
change_field (homeph, sizeof homeph, _("Home Phone"));
- else
+ } else {
printf (_("\tHome Phone: %s\n"), homeph);
+ }
- if (amroot)
+ if (amroot) {
change_field (slop, sizeof slop, _("Other"));
+ }
}
/*
@@ -189,22 +201,26 @@
char *cp = NULL;
while (in) {
- if ((cp = strchr (in, ',')))
+ if ((cp = strchr (in, ','))) {
*cp++ = '\0';
+ }
- if (!strchr (in, '='))
+ if (!strchr (in, '=')) {
break;
+ }
if (extra) {
- if (extra[0])
+ if (extra[0]) {
strcat (extra, ",");
+ }
strcat (extra, in);
}
in = cp;
}
- if (in && out)
+ if (in && out) {
strcpy (out, in);
+ }
return cp;
}
@@ -325,8 +341,9 @@
* any changes can be made. Idea from util-linux chfn/chsh.
* --marekm
*/
- if (!amroot && getdef_bool ("CHFN_AUTH"))
+ if (!amroot && getdef_bool ("CHFN_AUTH")) {
passwd_check (pw->pw_name, pw->pw_passwd, "chfn");
+ }
#else /* !USE_PAM */
retval = PAM_SUCCESS;
@@ -476,27 +493,31 @@
* Now get the room number. It is the next comma separated field,
* if there is indeed one.
*/
- if (cp)
+ if (cp) {
cp = copy_field (cp, rflg ? (char *) 0 : roomno, slop);
+ }
/*
* Now get the work phone number. It is the third field.
*/
- if (cp)
+ if (cp) {
cp = copy_field (cp, wflg ? (char *) 0 : workph, slop);
+ }
/*
* Now get the home phone number. It is the fourth field.
*/
- if (cp)
+ if (cp) {
cp = copy_field (cp, hflg ? (char *) 0 : homeph, slop);
+ }
/*
* Anything left over is "slop".
*/
if (cp && !oflg) {
- if (slop[0])
+ if (slop[0]) {
strcat (slop, ",");
+ }
strcat (slop, cp);
}
More information about the Pkg-shadow-commits
mailing list