summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-07-14 21:23:59 +0000
committerJeremy Allison <jra@samba.org>1998-07-14 21:23:59 +0000
commit59d07445b61e26321e3a1770c13756ac5948aabb (patch)
tree86286c7a304d26109ece60f7c3a5af5374a7757e /source3/utils
parenta5ddf0881e2410b7d4d8f1a389785e4db28d989e (diff)
downloadsamba-59d07445b61e26321e3a1770c13756ac5948aabb.tar.gz
samba-59d07445b61e26321e3a1770c13756ac5948aabb.tar.bz2
samba-59d07445b61e26321e3a1770c13756ac5948aabb.zip
loadparm.c:
With apologies to Charlton Heston and Pierre Boule. "You damn fools, you finally did it". Changed default security mode to be security=user. Yes this is a big (although small in code) change. It's something we've been discussing for a while, to finally wean people off the legacy security=share mode which is *never* what you want. Jeremy. nmbd_incomingrequests.c: Bug fix for nmbd core dumps caused by overrun. Found by <samuel@public.szonline.net>. nttrans.c: More NT smb stuff. reply.c: Unlink will overwrite an existing file. Well you learn something new about POSIX every day. :-). server.c: Tidyup unreadable code. smbpasswd.c: Code to allow -U remote_username to allow ordinary users to change remote passwords if their NT username is different from their UNIX username. Patch from <torbjorn.lindh@allgon.se>. Jeremy. (This used to be commit 4eccb47cfb3c8907a6558b6ea9a02b0184458e34)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/smbpasswd.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index c9742fc498..f9b9506297 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -33,9 +33,9 @@ static void usage(char *name, BOOL is_root)
{
if(is_root)
fprintf(stderr, "Usage is : %s [-D DEBUGLEVEL] [-a] [-d] [-m] [-n] [username] [password]\n\
-%s: [-R <name resolve order>] [-D DEBUGLEVEL] [-j DOMAINNAME] [-r machine] [username] [password]\n%s: [-h]\n", name, name, name);
+%s: [-R <name resolve order>] [-D DEBUGLEVEL] [-j DOMAINNAME] [-r machine] [-U remote_username] [username] [password]\n%s: [-h]\n", name, name, name);
else
- fprintf(stderr, "Usage is : %s [-h] [-D DEBUGLEVEL] [-r machine] [password]\n", name);
+ fprintf(stderr, "Usage is : %s [-h] [-D DEBUGLEVEL] [-r machine] [-U remote_username] [password]\n", name);
exit(1);
}
@@ -134,6 +134,7 @@ int main(int argc, char **argv)
int err;
BOOL is_root = False;
pstring user_name;
+ BOOL remote_user_name = False;
char *remote_machine = NULL;
BOOL add_user = False;
BOOL got_new_pass = False;
@@ -201,7 +202,7 @@ int main(int argc, char **argv)
is_root = (real_uid == 0);
- while ((ch = getopt(argc, argv, "adhmnj:r:R:D:")) != EOF) {
+ while ((ch = getopt(argc, argv, "adhmnj:r:R:D:U:")) != EOF) {
switch(ch) {
case 'a':
if(is_root)
@@ -250,6 +251,10 @@ int main(int argc, char **argv)
} else
usage(prog_name, is_root);
break;
+ case 'U':
+ remote_user_name = True;
+ pstrcpy(user_name, optarg);
+ break;
case 'h':
default:
usage(prog_name, is_root);
@@ -259,6 +264,11 @@ int main(int argc, char **argv)
argc -= optind;
argv += optind;
+ if (!is_root && remote_user_name && !remote_machine) {
+ fprintf(stderr, "%s: You can only use -U with -r.\n", prog_name);
+ usage(prog_name, False);
+ }
+
/*
* Ensure add_user and either remote machine or join domain are
* not both set.
@@ -314,12 +324,7 @@ int main(int argc, char **argv)
}
}
- /*
- * Setup the pwd struct to point to known
- * values for a machine account (it doesn't
- * exist in /etc/passwd).
- */
- if((pwd = Get_Pwnam(user_name, True)) == NULL) {
+ if(!remote_machine && ((pwd = Get_Pwnam(user_name, True)) == NULL)) {
fprintf(stderr, "%s: User \"%s\" was not found in system password file.\n",
prog_name, user_name);
exit(1);
@@ -344,7 +349,7 @@ int main(int argc, char **argv)
got_new_pass = True;
}
- if((pwd = getpwuid(real_uid)) != NULL)
+ if(!remote_user_name && ((pwd = getpwuid(real_uid)) != NULL))
pstrcpy( user_name, pwd->pw_name);
/*