[Pkg-shadow-commits] r3117 - in upstream/trunk: . lib po src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Tue Mar 16 19:14:55 UTC 2010
Author: nekral-guest
Date: 2010-03-16 19:14:54 +0000 (Tue, 16 Mar 2010)
New Revision: 3117
Modified:
upstream/trunk/ChangeLog
upstream/trunk/lib/tcbfuncs.c
upstream/trunk/po/POTFILES.in
upstream/trunk/src/useradd.c
upstream/trunk/src/userdel.c
Log:
* po/POTFILES.in, lib/tcbfuncs.c: Add more strings for
translation.
* lib/tcbfuncs.c: Indicate the name of the program in error
messages. Avoid perror.
* src/useradd.c: Re-indent.
* src/useradd.c: Add more strings for translation. Indicate the
name of the program in error messages.
* src/userdel.c: Re-indent.
* src/userdel.c: Add more strings for translation. Indicate the
name of the program in error messages.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2010-03-16 19:14:37 UTC (rev 3116)
+++ upstream/trunk/ChangeLog 2010-03-16 19:14:54 UTC (rev 3117)
@@ -1,5 +1,18 @@
2010-03-15 Nicolas François <nicolas.francois at centraliens.net>
+ * po/POTFILES.in, lib/tcbfuncs.c: Add more strings for
+ translation.
+ * lib/tcbfuncs.c: Indicate the name of the program in error
+ messages. Avoid perror.
+ * src/useradd.c: Re-indent.
+ * src/useradd.c: Add more strings for translation. Indicate the
+ name of the program in error messages.
+ * src/userdel.c: Re-indent.
+ * src/userdel.c: Add more strings for translation. Indicate the
+ name of the program in error messages.
+
+2010-03-15 Nicolas François <nicolas.francois at centraliens.net>
+
* src/usermod.c: user_newname and user_newid cannot be used to
test if the username or ID is changed. lflg and uflg should be
used instead.
Modified: upstream/trunk/lib/tcbfuncs.c
===================================================================
--- upstream/trunk/lib/tcbfuncs.c 2010-03-16 19:14:37 UTC (rev 3116)
+++ upstream/trunk/lib/tcbfuncs.c 2010-03-16 19:14:54 UTC (rev 3117)
@@ -63,7 +63,7 @@
* to exit soon.
*/
#define OUT_OF_MEMORY do { \
- fprintf(stderr, "Out of memory.\n"); \
+ fprintf(stderr, _("%s: out of memory\n"), Prog); \
fflush(stderr); \
return 0; \
} while(0)
@@ -101,7 +101,7 @@
OUT_OF_MEMORY;
}
if (lstat(path, &st)) {
- fprintf(stderr, "Cannot stat %s: %s\n", path, strerror(errno));
+ fprintf(stderr, _("%s: Cannot stat %s: %s\n"), Prog, path, strerror(errno));
free(path);
return NULL;
}
@@ -114,19 +114,19 @@
return rval;
}
if (!S_ISLNK(st.st_mode)) {
- fprintf(stderr, "%s is neither a directory, nor a symlink.\n", path);
+ fprintf(stderr, _("%s: %s is neither a directory, nor a symlink.\n"), Prog, path);
free(path);
return NULL;
}
ret = readlink(path, link, sizeof(link) - 1);
free(path);
if (ret == -1) {
- perror("readlink");
+ fprintf(stderr, _("%s: Cannot read symbolic link %s: %s\n"), Prog, path, strerror(errno));
return NULL;
}
if (ret >= sizeof(link) - 1) {
link[sizeof(link) - 1] = '\0';
- fprintf(stderr, "Suspiciously long symlink: %s\n", link);
+ fprintf(stderr, _("%s: Suspiciously long symlink: %s\n"), Prog, link);
return NULL;
}
link[ret] = '\0';
@@ -174,7 +174,7 @@
return 0;
ptr = path;
if (stat(TCB_DIR, &st)) {
- perror("stat");
+ fprintf(stderr, _("%s: Cannot stat %s: %s\n"), Prog, TCB_DIR, strerror(errno));
goto out_free_path;
}
while ((ind = strchr(ptr, '/'))) {
@@ -184,15 +184,15 @@
OUT_OF_MEMORY;
}
if (mkdir(dir, 0700) && errno != EEXIST) {
- perror("mkdir");
+ fprintf(stderr, _("%s: Cannot create directory %s: %s\n"), Prog, dir, strerror(errno));
goto out_free_dir;
}
if (chown(dir, 0, st.st_gid)) {
- perror("chown");
+ fprintf(stderr, _("%s: Cannot change owner of %s: %s\n"), Prog, dir, strerror(errno));
goto out_free_dir;
}
if (chmod(dir, 0711)) {
- perror("chmod");
+ fprintf(stderr, _("%s: Cannot change mode of %s: %s\n"), Prog, dir, strerror(errno));
goto out_free_dir;
}
free(dir);
@@ -220,8 +220,7 @@
OUT_OF_MEMORY;
}
if (unlink(tmp) && errno != ENOENT) {
- fprintf(stderr, "unlink: %s: %s\n", tmp,
- strerror(errno));
+ fprintf(stderr, _("%s: unlink: %s: %s\n"), Prog, tmp, strerror(errno));
free(tmp);
return 0;
}
@@ -244,7 +243,7 @@
}
if (rmdir(dir)) {
if (errno != ENOTEMPTY) {
- perror("rmdir");
+ fprintf(stderr, _("%s: Cannot removedirectory %s: %s\n"), Prog, dir, strerror(errno));
ret = 0;
}
free(dir);
@@ -268,7 +267,7 @@
if (!olddir)
goto out_free_nomem;
if (stat(olddir, &oldmode)) {
- perror("stat");
+ fprintf(stderr, _("%s: Cannot stat %s: %s\n"), Prog, olddir, strerror(errno));
goto out_free;
}
old_uid = oldmode.st_uid;
@@ -286,13 +285,13 @@
if (!mkdir_leading(user_newname, the_newid))
goto out_free;
if (rename(real_old_dir, real_new_dir)) {
- perror("rename");
+ fprintf(stderr, _("%s: Cannot rename %s to %s: %s\n"), Prog, real_old_dir, real_new_dir, strerror(errno));
goto out_free;
}
if (!rmdir_leading(real_old_dir_rel))
goto out_free;
if (unlink(olddir) && errno != ENOENT) {
- perror("unlink");
+ fprintf(stderr, _("%s: Cannot remove %s: %s\n"), Prog, olddir, strerror(errno));
goto out_free;
}
asprintf(&newdir, TCB_DIR "/%s", user_newname);
@@ -301,13 +300,13 @@
if (!(real_new_dir_rel = shadowtcb_path_rel(user_newname, the_newid)))
goto out_free;
if (strcmp(real_new_dir, newdir) && symlink(real_new_dir_rel, newdir)) {
- perror("symlink");
+ fprintf(stderr, _("%s: Cannot create symbolic link %s: %s\n"), Prog, real_new_dir_rel, strerror(errno));
goto out_free;
}
ret = 1;
goto out_free;
out_free_nomem:
- fprintf(stderr, "Out of memory\n");
+ fprintf(stderr, _("%s: out of memory\n"), Prog); \
fflush(stderr);
out_free:
free(olddir);
@@ -386,48 +385,48 @@
OUT_OF_MEMORY;
}
if (stat(tcbdir, &dirmode)) {
- perror("stat");
+ fprintf(stderr, _("%s: Cannot stat %s: %s\n"), Prog, tcbdir, strerror(errno));
goto out_free;
}
if (chown(tcbdir, 0, 0)) {
- perror("chown");
+ fprintf(stderr, _("%s: Cannot change owners of %s: %s\n"), Prog, tcbdir, strerror(errno));
goto out_free;
}
if (chmod(tcbdir, 0700)) {
- perror("chmod");
+ fprintf(stderr, _("%s: Cannot change mode of %s: %s\n"), Prog, tcbdir, strerror(errno));
goto out_free;
}
if (lstat(shadow, &filemode)) {
if (errno != ENOENT) {
- perror("lstat");
+ fprintf(stderr, _("%s: Cannot lstat %s: %s\n"), Prog, shadow, strerror(errno));
goto out_free;
}
fprintf(stderr,
- "Warning, user %s has no tcb shadow file.\n",
- user_newname);
+ _("%s: Warning, user %s has no tcb shadow file.\n"),
+ Prog, user_newname);
} else {
if (!S_ISREG(filemode.st_mode) ||
filemode.st_nlink != 1) {
fprintf(stderr,
- "Emergency: %s's tcb shadow is not a regular file"
+ _("%s: Emergency: %s's tcb shadow is not a regular file"
" with st_nlink=1.\n"
- "The account is left locked.\n",
- user_newname);
+ "The account is left locked.\n"),
+ Prog, user_newname);
goto out_free;
}
if (chown(shadow, user_newid, filemode.st_gid)) {
- perror("chown");
+ fprintf(stderr, _("%s: Cannot change owner of %s: %s\n"), Prog, shadow, strerror(errno));
goto out_free;
}
if (chmod(shadow, filemode.st_mode & 07777)) {
- perror("chmod");
+ fprintf(stderr, _("%s: Cannot change mode of %s: %s\n"), Prog, shadow, strerror(errno));
goto out_free;
}
}
if (!unlink_suffs(user_newname))
goto out_free;
if (chown(tcbdir, user_newid, dirmode.st_gid)) {
- perror("chown");
+ fprintf(stderr, _("%s: Cannot change owner of %s: %s\n"), Prog, tcbdir, strerror(errno));
goto out_free;
}
ret = 1;
@@ -448,7 +447,7 @@
if (!getdef_bool("USE_TCB"))
return 1;
if (stat(TCB_DIR, &tcbdir_stat)) {
- perror("stat");
+ fprintf(stderr, _("%s: Cannot stat %s: %s\n"), Prog, tcbdir, strerror(errno));
return 0;
}
shadowgid = tcbdir_stat.st_gid;
@@ -465,30 +464,30 @@
OUT_OF_MEMORY;
}
if (mkdir(dir, 0700)) {
- fprintf(stderr, "mkdir: %s: %s\n", dir, strerror(errno));
+ fprintf(stderr, _("%s: mkdir: %s: %s\n"), Prog, dir, strerror(errno));
goto out_free;
return 0;
}
fd = open(shadow, O_RDWR | O_CREAT | O_TRUNC, 0600);
if (fd < 0) {
- perror("open");
+ fprintf(stderr, _("%s: Cannot open %s: %s\n"), Prog, shadow, strerror(errno));
goto out_free;
}
close(fd);
if (chown(shadow, 0, authgid)) {
- perror("chown");
+ fprintf(stderr, _("%s: Cannot change owner of %s: %s\n"), Prog, shadow, strerror(errno));
goto out_free;
}
if (chmod(shadow, authgid == shadowgid ? 0600 : 0640)) {
- perror("chmod");
+ fprintf(stderr, _("%s: Cannot change mode of %s: %s\n"), Prog, shadow, strerror(errno));
goto out_free;
}
if (chown(dir, 0, authgid)) {
- perror("chown");
+ fprintf(stderr, _("%s: Cannot change owner of %s: %s\n"), Prog, dir, strerror(errno));
goto out_free;
}
if (chmod(dir, authgid == shadowgid ? 02700 : 02710)) {
- perror("chmod");
+ fprintf(stderr, _("%s: Cannot change mode of %s: %s\n"), Prog, dir, strerror(errno));
goto out_free;
}
if (!shadowtcb_set_user(name) || !shadowtcb_move(NULL, uid))
Modified: upstream/trunk/po/POTFILES.in
===================================================================
--- upstream/trunk/po/POTFILES.in 2010-03-16 19:14:37 UTC (rev 3116)
+++ upstream/trunk/po/POTFILES.in 2010-03-16 19:14:54 UTC (rev 3117)
@@ -24,6 +24,7 @@
lib/shadowio.c
lib/shadowmem.c
lib/utent.c
+lib/tcbfuncs.c
libmisc/addgrps.c
libmisc/age.c
libmisc/audit_help.c
Modified: upstream/trunk/src/useradd.c
===================================================================
--- upstream/trunk/src/useradd.c 2010-03-16 19:14:37 UTC (rev 3116)
+++ upstream/trunk/src/useradd.c 2010-03-16 19:14:54 UTC (rev 3117)
@@ -1312,7 +1312,7 @@
if (!rflg) {
/* for system accounts defaults are ignored and we
* do not create a home dir */
- if (getdef_bool("CREATE_HOME")) {
+ if (getdef_bool ("CREATE_HOME")) {
mflg = true;
}
}
@@ -2002,14 +2002,16 @@
}
#ifdef WITH_TCB
- if (getdef_bool("USE_TCB")) {
- if (shadowtcb_create(user_name, user_id) == 0) {
- fprintf(stderr, "Failed to create tcb directory for %s\n", user_name);
+ if (getdef_bool ("USE_TCB")) {
+ if (shadowtcb_create (user_name, user_id) == 0) {
+ fprintf (stderr,
+ _("%s: Failed to create tcb directory for %s\n"),
+ Prog, user_name);
fail_exit (E_UID_IN_USE);
}
}
#endif
- open_shadow();
+ open_shadow ();
/* do we have to add a group for that user? This is why we need to
* open the group files in the open_files() function --gafton */
@@ -2039,7 +2041,7 @@
}
/* Do not create mail directory for system accounts */
- if( !rflg ) {
+ if (!rflg) {
create_mail ();
}
Modified: upstream/trunk/src/userdel.c
===================================================================
--- upstream/trunk/src/userdel.c 2010-03-16 19:14:37 UTC (rev 3116)
+++ upstream/trunk/src/userdel.c 2010-03-16 19:14:54 UTC (rev 3117)
@@ -751,15 +751,15 @@
buf = malloc (buflen);
if (NULL == buf) {
- fprintf (stderr, "Can't allocate memory, "
- "tcb entry for %s not removed.\n",
- user_name);
+ fprintf (stderr, _("%s: Can't allocate memory, "
+ "tcb entry for %s not removed.\n"),
+ Prog, user_name);
return 1;
}
snprintf (buf, buflen, TCB_DIR "/%s", user_name);
if (shadowtcb_drop_priv () == 0) {
- fprintf (stderr, "Cannot drop privileges: %s\n",
- strerror (errno));
+ fprintf (stderr, _("%s: Cannot drop privileges: %s\n"),
+ Prog, strerror (errno));
shadowtcb_gain_priv ();
free (buf);
return 1;
@@ -768,8 +768,8 @@
* We will regain them and remove the user's tcb directory afterwards.
*/
if (remove_tree (buf, false) != 0) {
- fprintf (stderr, "Cannot remove the content of %s: %s\n",
- buf, strerror (errno));
+ fprintf (stderr, _("%s: Cannot remove the content of %s: %s\n"),
+ Prog, buf, strerror (errno));
shadowtcb_gain_priv ();
free (buf);
return 1;
@@ -777,8 +777,8 @@
shadowtcb_gain_priv ();
free (buf);
if (shadowtcb_remove (user_name) == 0) {
- fprintf (stderr, "Cannot remove tcb files for %s: %s\n",
- user_name, strerror (errno));
+ fprintf (stderr, _("%s: Cannot remove tcb files for %s: %s\n"),
+ Prog, user_name, strerror (errno));
ret = 1;
}
return ret;
@@ -920,12 +920,12 @@
char *nis_master;
fprintf (stderr,
- _("%s: user %s is a NIS user\n"), Prog, user_name);
+ _("%s: user %s is a NIS user\n"), Prog, user_name);
if ( !yp_get_default_domain (&nis_domain)
&& !yp_master (nis_domain, "passwd.byname", &nis_master)) {
fprintf (stderr,
- _("%s: %s is the NIS master\n"),
- Prog, nis_master);
+ _("%s: %s is the NIS master\n"),
+ Prog, nis_master);
}
exit (E_NOTFOUND);
}
@@ -996,9 +996,8 @@
}
if (path_prefix (user_home, pwd->pw_dir)) {
fprintf (stderr,
- _
- ("%s: not removing directory %s (would remove home of user %s)\n"),
- Prog, user_home, pwd->pw_name);
+ _("%s: not removing directory %s (would remove home of user %s)\n"),
+ Prog, user_home, pwd->pw_name);
rflg = false;
errors++;
/* continue */
More information about the Pkg-shadow-commits
mailing list