summaryrefslogtreecommitdiff
path: root/source3/utils/smbpasswd.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-11-06 18:40:51 +0000
committerJeremy Allison <jra@samba.org>1998-11-06 18:40:51 +0000
commit4bd1feb68c4f5134293d87433da932c20cded915 (patch)
treed25363592d47b9ef33a44af17d1852f5c8ae4a94 /source3/utils/smbpasswd.c
parent675e92301c5786ecaea29025598c76c5d7967c8b (diff)
downloadsamba-4bd1feb68c4f5134293d87433da932c20cded915.tar.gz
samba-4bd1feb68c4f5134293d87433da932c20cded915.tar.bz2
samba-4bd1feb68c4f5134293d87433da932c20cded915.zip
lib/charcnv.c: Improved debug comment.
libsmb/namequery.c: Fix to remove 2 second wait is we are doing a unicast and got a reply. smbd/dfree.c: smbd/noquotas.c: smbd/quotas.c: Fixes from Dejan Ilic <svedja@lysator.liu.se> for the quota code. utils/smbpasswd.c: Fixes to allow smbpasswd to be called from swat. Jeremy. (This used to be commit b5981c0149ad8c6f13ea87db450080616538b5d5)
Diffstat (limited to 'source3/utils/smbpasswd.c')
-rw-r--r--source3/utils/smbpasswd.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 2d4ce319e8..147e3492af 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -191,7 +191,8 @@ int main(int argc, char **argv)
extern char *optarg;
extern int optind;
extern int DEBUGLEVEL;
- int real_uid;
+ uid_t real_uid;
+ uid_t eff_uid;
struct passwd *pwd = NULL;
fstring old_passwd;
fstring new_passwd;
@@ -217,7 +218,7 @@ int main(int argc, char **argv)
char *new_domain = NULL;
pstring servicesf = CONFIGFILE;
void *vp;
- struct nmb_name calling, called;
+ struct nmb_name calling, called;
new_passwd[0] = '\0';
@@ -265,16 +266,17 @@ int main(int argc, char **argv)
codepage_initialise(lp_client_code_page());
- /* Get the real uid */
+ /* Get the real and effective uids */
real_uid = getuid();
-
+ eff_uid = geteuid();
+
/* Check the effective uid */
- if ((geteuid() == 0) && (real_uid != 0)) {
+ if ((eff_uid == (uid_t)0) && (real_uid != (uid_t)0)) {
fprintf(stderr, "%s: Must *NOT* be setuid root.\n", prog_name);
exit(1);
}
- is_root = (real_uid == 0);
+ is_root = (eff_uid == (uid_t)0);
while ((ch = getopt(argc, argv, "adehmnj:r:sR:D:U:")) != EOF) {
switch(ch) {
@@ -434,7 +436,7 @@ int main(int argc, char **argv)
exit(1);
}
} else {
- if((pwd = getpwuid(real_uid)) != NULL)
+ if((pwd = getpwuid(eff_uid)) != NULL)
pstrcpy( user_name, pwd->pw_name);
}
@@ -463,7 +465,7 @@ int main(int argc, char **argv)
got_new_pass = True;
}
- if(!remote_user_name && ((pwd = getpwuid(real_uid)) != NULL))
+ if(!remote_user_name && ((pwd = getpwuid(eff_uid)) != NULL))
pstrcpy( user_name, pwd->pw_name);
/*