mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-28 12:05:47 +08:00
* passwd.c (main): Add the ability to specify a username for the -R
command. * utils.sgml: Document the aforementioned change.
This commit is contained in:
parent
1db2e3fbfb
commit
ff73fd1ec1
@ -1,3 +1,9 @@
|
|||||||
|
2011-04-04 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* passwd.c (main): Add the ability to specify a username for the -R
|
||||||
|
command.
|
||||||
|
* utils.sgml: Document the aforementioned change.
|
||||||
|
|
||||||
2011-02-29 Corinna Vinschen <corinna@vinschen.de>
|
2011-02-29 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* regtool.cc (cmd_set): Avoid a compiler warning.
|
* regtool.cc (cmd_set): Avoid a compiler warning.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* passwd.c: Changing passwords and managing account information
|
/* passwd.c: Changing passwords and managing account information
|
||||||
|
|
||||||
Copyright 1999, 2000, 2001, 2002, 2003, 2008, 2009 Red Hat, Inc.
|
Copyright 1999, 2000, 2001, 2002, 2003, 2008, 2009, 2011 Red Hat, Inc.
|
||||||
|
|
||||||
Written by Corinna Vinschen <corinna.vinschen@cityweb.de>
|
Written by Corinna Vinschen <corinna.vinschen@cityweb.de>
|
||||||
|
|
||||||
@ -544,8 +544,26 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
if (Ropt)
|
if (Ropt)
|
||||||
{
|
{
|
||||||
|
const char *username = NULL;
|
||||||
|
if (optind < argc)
|
||||||
|
{
|
||||||
|
username = argv[optind++];
|
||||||
|
if (!strcmp (username, getlogin ()))
|
||||||
|
username = NULL;
|
||||||
|
else if (!caller_is_admin ())
|
||||||
|
return eprint (0, "You may not change the password for %s.", user);
|
||||||
|
|
||||||
if (optind < argc)
|
if (optind < argc)
|
||||||
usage (stderr, 1);
|
usage (stderr, 1);
|
||||||
|
}
|
||||||
|
char *text1 = (char *) alloca ((username ? strlen (username) + 2 : 4)
|
||||||
|
+ sizeof ("Enter current password: "));
|
||||||
|
char *text2 = (char *) alloca ((username ? strlen (username) + 2 : 4)
|
||||||
|
+ sizeof ("Re-enter current password: "));
|
||||||
|
sprintf (text1, "Enter %s%s current password: ",
|
||||||
|
username ?: "your", username ? "'s" : "");
|
||||||
|
sprintf (text2, "Re-enter %s%s current password: ",
|
||||||
|
username ?: "your", username ? "'s" : "");
|
||||||
printf (
|
printf (
|
||||||
"This functionality stores a password in the registry for usage by services\n"
|
"This functionality stores a password in the registry for usage by services\n"
|
||||||
"which need to change the user context and require network access. Typical\n"
|
"which need to change the user context and require network access. Typical\n"
|
||||||
@ -556,11 +574,11 @@ main (int argc, char **argv)
|
|||||||
"secure. Use this feature only if the machine is adequately locked down.\n"
|
"secure. Use this feature only if the machine is adequately locked down.\n"
|
||||||
"Don't use this feature if you don't need network access within a remote\n"
|
"Don't use this feature if you don't need network access within a remote\n"
|
||||||
"session.\n\n"
|
"session.\n\n"
|
||||||
"You can delete your stored password by specifying an empty password.\n\n");
|
"You can delete the stored password by specifying an empty password.\n\n");
|
||||||
strcpy (newpwd, getpass ("Enter your current password: "));
|
strcpy (newpwd, getpass (text1));
|
||||||
if (strcmp (newpwd, getpass ("Re-enter your current password: ")))
|
if (strcmp (newpwd, getpass (text2)))
|
||||||
eprint (0, "Password is not identical.");
|
eprint (0, "Password is not identical.");
|
||||||
else if (cygwin_internal (CW_SET_PRIV_KEY, newpwd))
|
else if (cygwin_internal (CW_SET_PRIV_KEY, newpwd, username))
|
||||||
return eprint (0, "Storing password failed: %s", strerror (errno));
|
return eprint (0, "Storing password failed: %s", strerror (errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1307,12 +1307,14 @@ drawbacks security-wise. This is explained in more detail in
|
|||||||
|
|
||||||
<para>Please note that storing passwords in that registry area is a
|
<para>Please note that storing passwords in that registry area is a
|
||||||
privileged operation which only administrative accounts are allowed to
|
privileged operation which only administrative accounts are allowed to
|
||||||
do. If normal, non-admin users should be allowed to enter their
|
do. Administrators can enter the password for other user accounts into
|
||||||
passwords using <command>passwd -R</command>, it's required to run
|
the registry by specifying the username on the commandline. If normal,
|
||||||
<command>cygserver</command> as a service under the LocalSystem account
|
non-admin users should be allowed to enter their passwords using
|
||||||
before running <command>passwd -R</command>. This only affects storing
|
<command>passwd -R</command>, it's required to run <command>cygserver</command>
|
||||||
passwords. Using passwords in privileged processes does not require
|
as a service under the LocalSystem account before running
|
||||||
<command>cygserver</command> to run.</para>
|
<command>passwd -R</command>. This only affects storing passwords. Using
|
||||||
|
passwords in privileged processes does not require <command>cygserver</command>
|
||||||
|
to run.</para>
|
||||||
|
|
||||||
<para>Limitations: Users may not be able to change their password on
|
<para>Limitations: Users may not be able to change their password on
|
||||||
some systems.</para>
|
some systems.</para>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user