mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
Added fixes for machine accounts.
Jeremy.
This commit is contained in:
@ -254,6 +254,12 @@ handle password changing for root
|
|||||||
*************************************************************/
|
*************************************************************/
|
||||||
static int process_root(int argc, char *argv[])
|
static int process_root(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Next two lines needed for SunOS and don't
|
||||||
|
* hurt anything else...
|
||||||
|
*/
|
||||||
|
extern char *optarg;
|
||||||
|
extern int optind;
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
int ch;
|
int ch;
|
||||||
BOOL joining_domain = False;
|
BOOL joining_domain = False;
|
||||||
@ -359,29 +365,39 @@ static int process_root(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!remote_machine && !Get_Pwnam(user_name, True)) {
|
if (trust_account) {
|
||||||
fprintf(stderr, "User \"%s\" was not found in system password file.\n",
|
/* add the $ automatically */
|
||||||
user_name);
|
static fstring buf;
|
||||||
exit(1);
|
|
||||||
}
|
/*
|
||||||
|
* Remove any trailing '$' before we
|
||||||
|
* generate the initial machine password.
|
||||||
|
*/
|
||||||
|
|
||||||
if (user_name[strlen(user_name)-1] == '$') {
|
if (user_name[strlen(user_name)-1] == '$') {
|
||||||
user_name[strlen(user_name)-1] = 0;
|
user_name[strlen(user_name)-1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trust_account) {
|
|
||||||
/* add the $ automatically */
|
|
||||||
static fstring buf;
|
|
||||||
|
|
||||||
if (add_user) {
|
if (add_user) {
|
||||||
new_passwd = xstrdup(user_name);
|
new_passwd = xstrdup(user_name);
|
||||||
strlower(new_passwd);
|
strlower(new_passwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now ensure the username ends in '$' for
|
||||||
|
* the machine add.
|
||||||
|
*/
|
||||||
|
|
||||||
slprintf(buf, sizeof(buf)-1, "%s$", user_name);
|
slprintf(buf, sizeof(buf)-1, "%s$", user_name);
|
||||||
user_name = buf;
|
user_name = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!remote_machine && !Get_Pwnam(user_name, True)) {
|
||||||
|
fprintf(stderr, "User \"%s\" was not found in system password file.\n",
|
||||||
|
user_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (remote_machine != NULL) {
|
if (remote_machine != NULL) {
|
||||||
old_passwd = get_pass("Old SMB password:",stdin_passwd_get);
|
old_passwd = get_pass("Old SMB password:",stdin_passwd_get);
|
||||||
}
|
}
|
||||||
@ -433,6 +449,12 @@ handle password changing for non-root
|
|||||||
*************************************************************/
|
*************************************************************/
|
||||||
static int process_nonroot(int argc, char *argv[])
|
static int process_nonroot(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Next two lines needed for SunOS and don't
|
||||||
|
* hurt anything else...
|
||||||
|
*/
|
||||||
|
extern char *optarg;
|
||||||
|
extern int optind;
|
||||||
struct passwd *pwd = NULL;
|
struct passwd *pwd = NULL;
|
||||||
int ch;
|
int ch;
|
||||||
BOOL stdin_passwd_get = False;
|
BOOL stdin_passwd_get = False;
|
||||||
|
Reference in New Issue
Block a user