#include <fcntl.h>
#include <getopt.h>
#include <pwd.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
const struct group *gr;
struct group newgr;
int errors = 0;
- int line = 0;
+ intmax_t line = 0;
log_set_progname(Prog);
log_set_logfd(stderr);
while (fgets (buf, (int) sizeof buf, stdin) != NULL) {
line++;
if (stpsep(buf, "\n") == NULL) {
- fprintf (stderr, _("%s: line %d: line too long\n"),
+ fprintf (stderr, _("%s: line %jd: line too long\n"),
Prog, line);
errors++;
continue;
cp = stpsep(name, ":");
if (cp == NULL) {
fprintf (stderr,
- _("%s: line %d: missing new password\n"),
+ _("%s: line %jd: missing new password\n"),
Prog, line);
errors++;
continue;
gr = gr_locate (name);
if (NULL == gr) {
fprintf (stderr,
- _("%s: line %d: group '%s' does not exist\n"), Prog,
+ _("%s: line %jd: group '%s' does not exist\n"), Prog,
line, name);
errors++;
continue;
if (NULL != sg) {
if (sgr_update (&newsg) == 0) {
fprintf (stderr,
- _("%s: line %d: failed to prepare the new %s entry '%s'\n"),
+ _("%s: line %jd: failed to prepare the new %s entry '%s'\n"),
Prog, line, sgr_dbname (), newsg.sg_name);
errors++;
continue;
{
if (gr_update (&newgr) == 0) {
fprintf (stderr,
- _("%s: line %d: failed to prepare the new %s entry '%s'\n"),
+ _("%s: line %jd: failed to prepare the new %s entry '%s'\n"),
Prog, line, gr_dbname (), newgr.gr_name);
errors++;
continue;
#include <fcntl.h>
#include <getopt.h>
#include <pwd.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#endif /* USE_PAM */
int errors = 0;
- int line = 0;
+ intmax_t line = 0;
log_set_progname(Prog);
log_set_logfd(stderr);
}
fprintf (stderr,
- _("%s: line %d: line too long\n"),
+ _("%s: line %jd: line too long\n"),
Prog, line);
errors++;
continue;
cp = stpsep(name, ":");
if (cp == NULL) {
fprintf (stderr,
- _("%s: line %d: missing new password\n"),
+ _("%s: line %jd: missing new password\n"),
Prog, line);
errors++;
continue;
if (use_pam) {
if (do_pam_passwd_non_interactive (Prog, name, newpwd) != 0) {
fprintf (stderr,
- _("%s: (line %d, user %s) password not changed\n"),
+ _("%s: (line %jd, user %s) password not changed\n"),
Prog, line, name);
errors++;
}
pw = pw_locate (name);
if (NULL == pw) {
fprintf (stderr,
- _("%s: line %d: user '%s' does not exist\n"), Prog,
+ _("%s: line %jd: user '%s' does not exist\n"), Prog,
line, name);
errors++;
continue;
if (NULL != sp) {
if (spw_update (&newsp) == 0) {
fprintf (stderr,
- _("%s: line %d: failed to prepare the new %s entry '%s'\n"),
+ _("%s: line %jd: failed to prepare the new %s entry '%s'\n"),
Prog, line, spw_dbname (), newsp.sp_namp);
errors++;
continue;
|| !streq(pw->pw_passwd, SHADOW_PASSWD_STRING)) {
if (pw_update (&newpw) == 0) {
fprintf (stderr,
- _("%s: line %d: failed to prepare the new %s entry '%s'\n"),
+ _("%s: line %jd: failed to prepare the new %s entry '%s'\n"),
Prog, line, pw_dbname (), newpw.pw_name);
errors++;
continue;
#include <pwd.h>
#endif
#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
*/
fp = fopen (TABLE, "r");
if (NULL != fp) {
- int lineno = 0; /* for diagnostics */
+ intmax_t lineno = 0; /* for diagnostics */
while ( !match
&& (fgets (line, sizeof (line), fp) == line))
{
lineno++;
if (stpsep(line, "\n") == NULL) {
SYSLOG ((LOG_ERR,
- "%s: line %d: missing newline or line too long",
+ "%s: line %jd: missing newline or line too long",
TABLE, lineno));
continue;
}
froms = strsep(&p, ":");
if (froms == NULL || p != NULL) {
SYSLOG ((LOG_ERR,
- "%s: line %d: bad field count",
+ "%s: line %jd: bad field count",
TABLE, lineno));
continue;
}
if (perm[0] != '+' && perm[0] != '-') {
SYSLOG ((LOG_ERR,
- "%s: line %d: bad first field",
+ "%s: line %jd: bad first field",
TABLE, lineno));
continue;
}
#include <getopt.h>
#include <ctype.h>
#include <errno.h>
+#include <stdint.h>
#include <string.h>
#include "alloc/reallocf.h"
char *cp;
const struct passwd *pw;
struct passwd newpw;
- int line = 0;
+ intmax_t line = 0;
uid_t uid;
gid_t gid;
#ifdef USE_PAM
- int *lines = NULL;
+ intmax_t *lines = NULL;
char **usernames = NULL;
char **passwords = NULL;
unsigned int nusers = 0;
while (fgets (buf, sizeof buf, stdin) != NULL) {
line++;
if (stpsep(buf, "\n") == NULL && feof(stdin) == 0) {
- fprintf (stderr, _("%s: line %d: line too long\n"),
+ fprintf (stderr, _("%s: line %jd: line too long\n"),
Prog, line);
fail_exit (EXIT_FAILURE);
}
break;
}
if (nfields != 6) {
- fprintf (stderr, _("%s: line %d: invalid line\n"),
+ fprintf (stderr, _("%s: line %jd: invalid line\n"),
Prog, line);
fail_exit (EXIT_FAILURE);
}
if (NULL == pw && get_user_id(fields[2], &uid) != 0) {
fprintf (stderr,
- _("%s: line %d: can't create user\n"),
+ _("%s: line %jd: can't create user\n"),
Prog, line);
fail_exit (EXIT_FAILURE);
}
if ( (NULL == pw)
&& (add_group (fields[0], fields[3], &gid, uid) != 0)) {
fprintf (stderr,
- _("%s: line %d: can't create group\n"),
+ _("%s: line %jd: can't create group\n"),
Prog, line);
fail_exit (EXIT_FAILURE);
}
if ( (NULL == pw)
&& (add_user (fields[0], uid, gid) != 0)) {
fprintf (stderr,
- _("%s: line %d: can't create user\n"),
+ _("%s: line %jd: can't create user\n"),
Prog, line);
fail_exit (EXIT_FAILURE);
}
pw = pw_locate (fields[0]);
if (NULL == pw) {
fprintf (stderr,
- _("%s: line %d: user '%s' does not exist in %s\n"),
+ _("%s: line %jd: user '%s' does not exist in %s\n"),
Prog, line, fields[0], pw_dbname ());
fail_exit (EXIT_FAILURE);
}
#ifdef USE_PAM
/* keep the list of user/password for later update by PAM */
nusers++;
- lines = REALLOCF(lines, nusers, int);
+ lines = REALLOCF(lines, nusers, intmax_t);
usernames = REALLOCF(usernames, nusers, char *);
passwords = REALLOCF(passwords, nusers, char *);
if (lines == NULL || usernames == NULL || passwords == NULL) {
fprintf (stderr,
- _("%s: line %d: %s\n"),
+ _("%s: line %jd: %s\n"),
Prog, line, strerror(errno));
fail_exit (EXIT_FAILURE);
}
#endif /* USE_PAM */
if (add_passwd (&newpw, fields[1]) != 0) {
fprintf (stderr,
- _("%s: line %d: can't update password\n"),
+ _("%s: line %jd: can't update password\n"),
Prog, line);
fail_exit (EXIT_FAILURE);
}
0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
if (newpw.pw_dir[0] != '/') {
fprintf(stderr,
- _("%s: line %d: homedir must be an absolute path\n"),
+ _("%s: line %jd: homedir must be an absolute path\n"),
Prog, line);
fail_exit (EXIT_FAILURE);
}
if (mkdir (newpw.pw_dir, mode) != 0) {
fprintf (stderr,
- _("%s: line %d: mkdir %s failed: %s\n"),
+ _("%s: line %jd: mkdir %s failed: %s\n"),
Prog, line, newpw.pw_dir,
strerror (errno));
if (errno != EEXIST) {
if (chown(newpw.pw_dir, newpw.pw_uid, newpw.pw_gid) != 0)
{
fprintf (stderr,
- _("%s: line %d: chown %s failed: %s\n"),
+ _("%s: line %jd: chown %s failed: %s\n"),
Prog, line, newpw.pw_dir,
strerror (errno));
fail_exit (EXIT_FAILURE);
*/
if (pw_update (&newpw) == 0) {
fprintf (stderr,
- _("%s: line %d: can't update entry\n"),
+ _("%s: line %jd: can't update entry\n"),
Prog, line);
fail_exit (EXIT_FAILURE);
}
for (i = 0; i < nusers; i++) {
if (do_pam_passwd_non_interactive ("newusers", usernames[i], passwords[i]) != 0) {
fprintf (stderr,
- _("%s: (line %d, user %s) password not changed\n"),
+ _("%s: (line %jd, user %s) password not changed\n"),
Prog, lines[i], usernames[i]);
exit (EXIT_FAILURE);
}
#include <errno.h>
#include <grp.h>
#include <pwd.h>
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
static int isgrp (const char *, const char *);
-static int lines = 0;
+static intmax_t lines = 0;
int
if (stpsep(temp, "\n") == NULL) {
SYSLOG ((LOG_ERR,
- "%s, line %d: line too long or missing newline",
+ "%s, line %jd: line too long or missing newline",
SUAUTHFILE, lines));
continue;
}
action = strsep(&p, ":");
if (action == NULL || p != NULL) {
SYSLOG ((LOG_ERR,
- "%s, line %d. Bad number of fields.\n",
+ "%s, line %jd. Bad number of fields.\n",
SUAUTHFILE, lines));
continue;
}
return OWNPWORD;
} else {
SYSLOG ((LOG_ERR,
- "%s, line %d: unrecognized action!\n",
+ "%s, line %jd: unrecognized action!\n",
SUAUTHFILE, lines));
}
}
if (streq(tok, "ALL")) {
if (state != 0) {
SYSLOG ((LOG_ERR,
- "%s, line %d: ALL in bad place\n",
+ "%s, line %jd: ALL in bad place\n",
SUAUTHFILE, lines));
return 0;
}
} else if (streq(tok, "EXCEPT")) {
if (state != 1) {
SYSLOG ((LOG_ERR,
- "%s, line %d: EXCEPT in bas place\n",
+ "%s, line %jd: EXCEPT in bas place\n",
SUAUTHFILE, lines));
return 0;
}
} else if (streq(tok, "GROUP")) {
if ((state != 0) && (state != 2)) {
SYSLOG ((LOG_ERR,
- "%s, line %d: GROUP in bad place\n",
+ "%s, line %jd: GROUP in bad place\n",
SUAUTHFILE, lines));
return 0;
}
break;
case 1: /* An all */
SYSLOG ((LOG_ERR,
- "%s, line %d: expect another token after ALL\n",
+ "%s, line %jd: expect another token after ALL\n",
SUAUTHFILE, lines));
return 0;
case 2: /* All except */