fix spelling and unify whitespace

This commit is contained in:
a1346054
2021-08-18 18:06:02 +00:00
parent 4624e9fca1
commit 7687ae4dbd
39 changed files with 158 additions and 162 deletions

View File

@@ -263,7 +263,7 @@ static void print_date (time_t date)
char buf[80];
char format[80];
if( iflg ) {
if (iflg) {
(void) snprintf (format, 80, "%%Y-%%m-%%d");
}
else {

View File

@@ -515,7 +515,7 @@ int main (int argc, char **argv)
newpwd = cp;
#ifdef USE_PAM
if (use_pam){
if (use_pam) {
if (do_pam_passwd_non_interactive ("chpasswd", name, newpwd) != 0) {
fprintf (stderr,
_("%s: (line %d, user %s) password not changed\n"),
@@ -633,7 +633,7 @@ int main (int argc, char **argv)
newpw.pw_passwd = cp;
}
/*
/*
* The updated password file entry is then put back and will
* be written to the password file later, after all the
* other entries have been updated as well.

View File

@@ -217,7 +217,7 @@ static void setup_tty (void)
/*
* ttymon invocation prefers this, but these settings
* won't come into effect after the first username login
* won't come into effect after the first username login
*/
(void) STTY (0, &termio);
}
@@ -401,7 +401,7 @@ static void init_env (void)
}
}
#endif /* !USE_PAM */
/*
/*
* Add the clock frequency so that profiling commands work
* correctly.
*/
@@ -520,7 +520,7 @@ static void update_utmp (const char *user,
* of reasons, such as X servers or network logins.
*
* the flags which login supports are
*
*
* -p - preserve the environment
* -r - perform autologin protocol for rlogin
* -f - do not perform authentication, user is preauthenticated
@@ -650,7 +650,7 @@ int main (int argc, char **argv)
(void) umask (getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
{
/*
/*
* Use the ULIMIT in the login.defs file, and if
* there isn't one, use the default value. The
* user may have one for themselves, but otherwise,
@@ -983,12 +983,12 @@ int main (int argc, char **argv)
if (strcmp (user_passwd, "") == 0) {
char *prevent_no_auth = getdef_str("PREVENT_NO_AUTH");
if(prevent_no_auth == NULL) {
if (prevent_no_auth == NULL) {
prevent_no_auth = "superuser";
}
if(strcmp(prevent_no_auth, "yes") == 0) {
if (strcmp(prevent_no_auth, "yes") == 0) {
failed = true;
} else if( (pwd->pw_uid == 0)
} else if ((pwd->pw_uid == 0)
&& (strcmp(prevent_no_auth, "superuser") == 0)) {
failed = true;
}

View File

@@ -508,13 +508,13 @@ static void check_perms_nopam (const struct passwd *pw)
if (strcmp (pw->pw_passwd, "") == 0) {
char *prevent_no_auth = getdef_str("PREVENT_NO_AUTH");
if(prevent_no_auth == NULL) {
if (prevent_no_auth == NULL) {
prevent_no_auth = "superuser";
}
if(strcmp(prevent_no_auth, "yes") == 0) {
if (strcmp(prevent_no_auth, "yes") == 0) {
fprintf(stderr, _("Password field is empty, this is forbidden for all accounts.\n"));
exit(1);
} else if( (pw->pw_uid == 0)
} else if ((pw->pw_uid == 0)
&& (strcmp(prevent_no_auth, "superuser") == 0)) {
fprintf(stderr, _("Password field is empty, this is forbidden for super-user.\n"));
exit(1);
@@ -579,7 +579,7 @@ static void check_perms_nopam (const struct passwd *pw)
oldsig = signal (SIGQUIT, die);
/*
* See if the system defined authentication method is being used.
* See if the system defined authentication method is being used.
* The first character of an administrator defined method is an '@'
* character.
*/

View File

@@ -360,7 +360,7 @@ static void get_defaults (void)
char buf[1024];
char *cp;
if(prefix[0]) {
if (prefix[0]) {
size_t len;
int wlen;
@@ -460,8 +460,8 @@ static void get_defaults (void)
if ('\0' == *cp) {
cp = SKEL_DIR; /* XXX warning: const */
}
if(prefix[0]) {
if (prefix[0]) {
size_t len;
int wlen;
char* _def_template; /* avoid const warning */
@@ -490,7 +490,7 @@ static void get_defaults (void)
}
(void) fclose (fp);
getdef_err:
if(prefix[0]) {
if (prefix[0]) {
free(default_file);
}
}
@@ -551,7 +551,7 @@ static int set_defaults (void)
wlen = snprintf(new_file, len, "%s%s%s", prefix, prefix[0]?"/":"", NEW_USER_FILE);
assert (wlen <= (int) len -1);
if(prefix[0]) {
if (prefix[0]) {
len = strlen(prefix) + strlen(USER_DEFAULTS_FILE) + 2;
default_file = malloc(len);
if (default_file == NULL) {
@@ -722,7 +722,7 @@ static int set_defaults (void)
ret = 0;
setdef_err:
free(new_file);
if(prefix[0]) {
if (prefix[0]) {
free(default_file);
}
@@ -1049,7 +1049,7 @@ static void grp_update (void)
fail_exit (E_GRP_UPDATE); /* XXX */
}
/*
/*
* Add the username to the list of group members and
* update the group entry to reflect the change.
*/
@@ -1124,7 +1124,7 @@ static void grp_update (void)
fail_exit (E_GRP_UPDATE); /* XXX */
}
/*
/*
* Add the username to the list of group members and
* update the group entry to reflect the change.
*/
@@ -1534,7 +1534,7 @@ static void process_flags (int argc, char **argv)
user_home = uh;
}
if(prefix[0]) {
if (prefix[0]) {
size_t len = strlen(prefix) + strlen(user_home) + 2;
int wlen;
char* _prefix_user_home; /* to avoid const warning */
@@ -2331,7 +2331,7 @@ static void create_mail (void)
spool = "/var/mail";
}
file = alloca (strlen (prefix) + strlen (spool) + strlen (user_name) + 2);
if(prefix[0])
if (prefix[0])
sprintf (file, "%s/%s/%s", prefix, spool, user_name);
else
sprintf (file, "%s/%s", spool, user_name);
@@ -2385,18 +2385,18 @@ static void check_uid_range(int rflg, uid_t user_id)
{
uid_t uid_min ;
uid_t uid_max ;
if(rflg){
if (rflg) {
uid_min = (uid_t)getdef_ulong("SYS_UID_MIN",101UL);
uid_max = (uid_t)getdef_ulong("SYS_UID_MAX",getdef_ulong("UID_MIN",1000UL)-1);
if(uid_min <= uid_max){
if(user_id < uid_min || user_id >uid_max)
if (uid_min <= uid_max) {
if (user_id < uid_min || user_id >uid_max)
fprintf(stderr, _("%s warning: %s's uid %d outside of the SYS_UID_MIN %d and SYS_UID_MAX %d range.\n"), Prog, user_name, user_id, uid_min, uid_max);
}
}else{
uid_min = (uid_t)getdef_ulong("UID_MIN", 1000UL);
uid_max = (uid_t)getdef_ulong("UID_MAX", 6000UL);
if(uid_min <= uid_max){
if(user_id < uid_min || user_id >uid_max)
if (uid_min <= uid_max) {
if (user_id < uid_min || user_id >uid_max)
fprintf(stderr, _("%s warning: %s's uid %d outside of the UID_MIN %d and UID_MAX %d range.\n"), Prog, user_name, user_id, uid_min, uid_max);
}
}
@@ -2594,7 +2594,7 @@ int main (int argc, char **argv)
}
}
if(uflg)
if (uflg)
check_uid_range(rflg,user_id);
#ifdef WITH_TCB
if (getdef_bool ("USE_TCB")) {

View File

@@ -1046,7 +1046,7 @@ int main (int argc, char **argv)
{NULL, 0, NULL, '\0'}
};
while ((c = getopt_long (argc, argv,
#ifdef WITH_SELINUX
#ifdef WITH_SELINUX
"fhrR:P:Z",
#else /* !WITH_SELINUX */
"fhrR:P:",
@@ -1067,7 +1067,7 @@ int main (int argc, char **argv)
break;
case 'P': /* no-op, handled in process_prefix_flag () */
break;
#ifdef WITH_SELINUX
#ifdef WITH_SELINUX
case 'Z':
if (prefix[0]) {
fprintf (stderr,
@@ -1168,9 +1168,9 @@ int main (int argc, char **argv)
}
user_id = pwd->pw_uid;
user_gid = pwd->pw_gid;
if(prefix[0]) {
if (prefix[0]) {
size_t len = strlen(prefix) + strlen(pwd->pw_dir) + 2;
int wlen;
user_home = xmalloc(len);
@@ -1347,7 +1347,7 @@ int main (int argc, char **argv)
* Cancel any crontabs or at jobs. Have to do this before we remove
* the entry from /etc/passwd.
*/
if(prefix[0] == '\0')
if (prefix[0] == '\0')
user_cancel (user_name);
close_files ();

View File

@@ -370,7 +370,6 @@ static struct ulong_range getulong_range(const char *str)
result.last = (unsigned long int)last;
out:
return result;
}
struct ulong_range_list_entry {
@@ -949,7 +948,7 @@ static void update_gshadow (void)
changed = false;
/*
/*
* Update the group entry to reflect the changes.
*/
if (sgr_update (nsgrp) == 0) {
@@ -1281,7 +1280,7 @@ static void process_flags (int argc, char **argv)
if (!gflg) {
user_newgid = user_gid;
}
if(prefix[0]) {
if (prefix[0]) {
size_t len = strlen(prefix) + strlen(user_home) + 2;
int wlen;
prefix_user_home = xmalloc(len);
@@ -2247,7 +2246,7 @@ int main (int argc, char **argv)
if (sub_uid_remove(user_name, ptr->range.first, count) == 0) {
fprintf (stderr,
_("%s: failed to remove uid range %lu-%lu from '%s'\n"),
Prog, ptr->range.first, ptr->range.last,
Prog, ptr->range.first, ptr->range.last,
sub_uid_dbname ());
fail_exit (E_SUB_UID_UPDATE);
}
@@ -2260,7 +2259,7 @@ int main (int argc, char **argv)
if (sub_uid_add(user_name, ptr->range.first, count) == 0) {
fprintf (stderr,
_("%s: failed to add uid range %lu-%lu to '%s'\n"),
Prog, ptr->range.first, ptr->range.last,
Prog, ptr->range.first, ptr->range.last,
sub_uid_dbname ());
fail_exit (E_SUB_UID_UPDATE);
}
@@ -2273,7 +2272,7 @@ int main (int argc, char **argv)
if (sub_gid_remove(user_name, ptr->range.first, count) == 0) {
fprintf (stderr,
_("%s: failed to remove gid range %lu-%lu from '%s'\n"),
Prog, ptr->range.first, ptr->range.last,
Prog, ptr->range.first, ptr->range.last,
sub_gid_dbname ());
fail_exit (E_SUB_GID_UPDATE);
}
@@ -2286,7 +2285,7 @@ int main (int argc, char **argv)
if (sub_gid_add(user_name, ptr->range.first, count) == 0) {
fprintf (stderr,
_("%s: failed to add gid range %lu-%lu to '%s'\n"),
Prog, ptr->range.first, ptr->range.last,
Prog, ptr->range.first, ptr->range.last,
sub_gid_dbname ());
fail_exit (E_SUB_GID_UPDATE);
}