[Pkg-shadow-commits] r3182 - in upstream/trunk: . src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Tue Mar 23 11:26:35 UTC 2010
Author: nekral-guest
Date: 2010-03-23 11:26:34 +0000 (Tue, 23 Mar 2010)
New Revision: 3182
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/chage.c
upstream/trunk/src/groups.c
upstream/trunk/src/id.c
upstream/trunk/src/login.c
upstream/trunk/src/login_nopam.c
upstream/trunk/src/logoutd.c
upstream/trunk/src/newgrp.c
upstream/trunk/src/passwd.c
upstream/trunk/src/useradd.c
upstream/trunk/src/vipw.c
Log:
* src/newgrp.c: Limit the scope of variable pid.
* src/login_nopam.c: Limit the scope of variables end, lineno, i,
str_len.
* src/logoutd.c: Limit the scope of variable c.
* src/vipw.c: Re-indent.
* src/vipw.c: Close the file after the creation of the backup.
* src/useradd.c (set_default): Close input file on failure.
* src/useradd.c: Limit the scope of variables spool, file, fd, gr,
gid, mode.
* src/passwd.c: Limit the scope of variables last and ok.
* src/chage.c: Fix typo (non breaking space).
* src/login.c: Limit the scope of variables erasechar killchar, c,
failed.
* src/groups.c: Limit the scope of variable ngroups, pri_grp, i.
* src/id.c: Limit the scope of variable i.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/ChangeLog 2010-03-23 11:26:34 UTC (rev 3182)
@@ -1,3 +1,21 @@
+2010-03-23 Nicolas François <nicolas.francois at centraliens.net>
+
+ * src/newgrp.c: Limit the scope of variable pid.
+ * src/login_nopam.c: Limit the scope of variables end, lineno, i,
+ str_len.
+ * src/logoutd.c: Limit the scope of variable c.
+ * src/vipw.c: Re-indent.
+ * src/vipw.c: Close the file after the creation of the backup.
+ * src/useradd.c (set_default): Close input file on failure.
+ * src/useradd.c: Limit the scope of variables spool, file, fd, gr,
+ gid, mode.
+ * src/passwd.c: Limit the scope of variables last and ok.
+ * src/chage.c: Fix typo (non breaking space).
+ * src/login.c: Limit the scope of variables erasechar killchar, c,
+ failed.
+ * src/groups.c: Limit the scope of variable ngroups, pri_grp, i.
+ * src/id.c: Limit the scope of variable i.
+
2010-03-22 Nicolas François <nicolas.francois at centraliens.net>
* lib/utent.c (getutline): Remove getutline(). This function is
Modified: upstream/trunk/src/chage.c
===================================================================
--- upstream/trunk/src/chage.c 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/src/chage.c 2010-03-23 11:26:34 UTC (rev 3182)
@@ -270,7 +270,7 @@
}
if (NULL != cp) {
(void) printf ("%6.6s, %4.4s\n", cp + 4, cp + 20);
- } else {
+ } else {
(void) printf ("time_t: %lu\n", date);
}
#endif
Modified: upstream/trunk/src/groups.c
===================================================================
--- upstream/trunk/src/groups.c 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/src/groups.c 2010-03-23 11:26:34 UTC (rev 3182)
@@ -108,10 +108,7 @@
{
#ifdef HAVE_GETGROUPS
long sys_ngroups;
- int ngroups;
GETGROUPS_T *groups;
- int pri_grp; /* TODO: should be GETGROUPS_T */
- int i;
#else
char *logname;
char *getlogin ();
@@ -138,12 +135,14 @@
*/
#ifdef HAVE_GETGROUPS
+ int i;
+ int pri_grp; /* TODO: should be GETGROUPS_T */
/*
* This system supports concurrent group sets, so I can ask
* the system to tell me which groups are currently set for
* this process.
*/
- ngroups = getgroups (sys_ngroups, groups);
+ int ngroups = getgroups (sys_ngroups, groups);
if (ngroups < 0) {
perror ("getgroups");
exit (EXIT_FAILURE);
Modified: upstream/trunk/src/id.c
===================================================================
--- upstream/trunk/src/id.c 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/src/id.c 2010-03-23 11:26:34 UTC (rev 3182)
@@ -64,7 +64,6 @@
{
uid_t ruid, euid;
gid_t rgid, egid;
- int i;
long sys_ngroups;
/*
@@ -168,6 +167,7 @@
* The group numbers will be printed followed by their names.
*/
if (aflg && (ngroups = getgroups (sys_ngroups, groups)) != -1) {
+ int i;
/*
* Start off the group message. It will be of the format
Modified: upstream/trunk/src/login.c
===================================================================
--- upstream/trunk/src/login.c 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/src/login.c 2010-03-23 11:26:34 UTC (rev 3182)
@@ -167,10 +167,10 @@
static void setup_tty (void)
{
TERMIO termio;
- int erasechar;
- int killchar;
if (GTTY (0, &termio) == 0) { /* get terminal characteristics */
+ int erasechar;
+ int killchar;
/*
* Add your favorite terminal modes here ...
@@ -242,7 +242,6 @@
fname = getdef_str ("NOLOGINS_FILE");
if ((NULL != fname) && (access (fname, F_OK) == 0)) {
FILE *nlfp;
- int c;
/*
* Cat the file if it can be opened, otherwise just
@@ -250,6 +249,7 @@
*/
nlfp = fopen (fname, "r");
if (NULL != nlfp) {
+ int c;
while ((c = getc (nlfp)) != EOF) {
if (c == '\n') {
(void) putchar ('\r');
@@ -527,7 +527,6 @@
#endif
unsigned int delay;
unsigned int retries;
- bool failed;
bool subroot = false;
#ifndef USE_PAM
bool is_console;
@@ -773,7 +772,7 @@
*/
failcount = 0;
while (true) {
- failed = false;
+ bool failed = false;
failcount++;
#ifdef HAS_PAM_FAIL_DELAY
@@ -903,6 +902,7 @@
#else /* ! USE_PAM */
while (true) { /* repeatedly get login/password pairs */
+ bool failed;
/* user_passwd is always a pointer to this constant string
* or a passwd or shadow password that will be memzero by
* pw_free / spw_free.
Modified: upstream/trunk/src/login_nopam.c
===================================================================
--- upstream/trunk/src/login_nopam.c 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/src/login_nopam.c 2010-03-23 11:26:34 UTC (rev 3182)
@@ -81,8 +81,6 @@
char *users; /* becomes list of login names */
char *froms; /* becomes list of terminals or hosts */
bool match = false;
- int end;
- int lineno = 0; /* for diagnostics */
/*
* Process the table one line at a time and stop at the first match.
@@ -93,8 +91,10 @@
*/
fp = fopen (TABLE, "r");
if (NULL != fp) {
+ int lineno = 0; /* for diagnostics */
while ( !match
&& (fgets (line, (int) sizeof (line), fp) == line)) {
+ int end;
lineno++;
end = (int) strlen (line) - 1;
if (line[end] != '\n') {
@@ -211,7 +211,6 @@
#ifdef PRIMARY_GROUP_MATCH
struct passwd *userinf;
#endif
- int i;
char *at;
/*
@@ -232,6 +231,7 @@
return true;
/* local, no need for xgetgrnam */
} else if ((group = getgrnam (tok)) != NULL) { /* try group membership */
+ int i;
for (i = 0; NULL != group->gr_mem[i]; i++) {
if (strcasecmp (string, group->gr_mem[i]) == 0) {
return true;
@@ -280,7 +280,6 @@
static bool from_match (const char *tok, const char *string)
{
size_t tok_len;
- size_t str_len;
/*
* If a token has the magic value "ALL" the match always succeeds. Return
@@ -298,6 +297,7 @@
if (string_match (tok, string)) { /* ALL or exact match */
return true;
} else if (tok[0] == '.') { /* domain: match last fields */
+ size_t str_len;
str_len = strlen (string);
tok_len = strlen (tok);
if ( (str_len > tok_len)
Modified: upstream/trunk/src/logoutd.c
===================================================================
--- upstream/trunk/src/logoutd.c 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/src/logoutd.c 2010-03-23 11:26:34 UTC (rev 3182)
@@ -95,7 +95,6 @@
{
TERMIO oldt, newt;
FILE *mesg_file, *tty_file;
- int c;
bool is_tty;
tty_file = fdopen (tty_fd, "w");
@@ -114,6 +113,7 @@
mesg_file = fopen (HUP_MESG_FILE, "r");
if (NULL != mesg_file) {
+ int c;
while ((c = getc (mesg_file)) != EOF) {
if (c == '\n') {
putc ('\r', tty_file);
Modified: upstream/trunk/src/newgrp.c
===================================================================
--- upstream/trunk/src/newgrp.c 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/src/newgrp.c 2010-03-23 11:26:34 UTC (rev 3182)
@@ -282,7 +282,7 @@
* receives SIGCHLD from the terminating subshell. -- JWP
*/
{
- pid_t child, pid;
+ pid_t child;
/* Ignore these signals. The signal handlers will later be
* restored to the default handlers. */
@@ -316,6 +316,7 @@
int cst = 0;
gid_t gid = getgid();
struct group *grp = getgrgid (gid);
+ pid_t pid;
do {
errno = 0;
Modified: upstream/trunk/src/passwd.c
===================================================================
--- upstream/trunk/src/passwd.c 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/src/passwd.c 2010-03-23 11:26:34 UTC (rev 3182)
@@ -360,7 +360,7 @@
*/
static void check_password (const struct passwd *pw, const struct spwd *sp)
{
- time_t now, last, ok;
+ time_t now;
int exp_status;
exp_status = isexpired (pw, sp);
@@ -404,6 +404,7 @@
* Passwords may only be changed after sp_min time is up.
*/
if (sp->sp_lstchg > 0) {
+ time_t last, ok;
last = sp->sp_lstchg * SCALE;
ok = last + (sp->sp_min > 0 ? sp->sp_min * SCALE : 0);
Modified: upstream/trunk/src/useradd.c
===================================================================
--- upstream/trunk/src/useradd.c 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/src/useradd.c 2010-03-23 11:26:34 UTC (rev 3182)
@@ -485,6 +485,7 @@
fprintf (stderr,
_("%s: line too long in %s: %s..."),
Prog, def_file, buf);
+ (void) fclose (ifp);
return -1;
}
}
@@ -1804,13 +1805,13 @@
*/
static void create_mail (void)
{
- char *spool, *file;
- int fd;
- struct group *gr;
- gid_t gid;
- mode_t mode;
+ if (strcasecmp (create_mail_spool, "yes") == 0) {
+ char *spool, *file;
+ int fd;
+ struct group *gr;
+ gid_t gid;
+ mode_t mode;
- if (strcasecmp (create_mail_spool, "yes") == 0) {
spool = getdef_str ("MAIL_DIR");
if (NULL == spool) {
spool = "/var/mail";
Modified: upstream/trunk/src/vipw.c
===================================================================
--- upstream/trunk/src/vipw.c 2010-03-23 08:56:52 UTC (rev 3181)
+++ upstream/trunk/src/vipw.c 2010-03-23 11:26:34 UTC (rev 3182)
@@ -298,7 +298,7 @@
"%s %s", editor, fileedit);
if (system (buf) != 0) {
fprintf (stderr, "%s: %s: %s\n", progname, editor,
- strerror (errno));
+ strerror (errno));
exit (1);
} else {
exit (0);
@@ -369,6 +369,7 @@
free (to_rename);
vipwexit (_("failed to create backup file"), errno, 1);
}
+ (void) fclose (f);
} else {
#endif /* WITH_TCB */
to_rename = fileedit;
More information about the Pkg-shadow-commits
mailing list