svn commit: samba r17979 - in branches: SAMBA_3_0/source/utils
SAMBA_3_0_23/source/utils
jra at samba.org
jra at samba.org
Fri Sep 1 04:15:06 GMT 2006
Author: jra
Date: 2006-09-01 04:15:04 +0000 (Fri, 01 Sep 2006)
New Revision: 17979
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17979
Log:
Make ntlm_auth more intelligent about figuring out it's
domain and user args. if only given a parameter of the
form --username DOMAIN\user. When called by firefox
or other user apps they may not know what the domain
is (and they don't care). They just want to pass the
contents of $USERNAME without having to parse it
or guess a domain.
Jeremy.
Modified:
branches/SAMBA_3_0/source/utils/ntlm_auth.c
branches/SAMBA_3_0_23/source/utils/ntlm_auth.c
Changeset:
Modified: branches/SAMBA_3_0/source/utils/ntlm_auth.c
===================================================================
--- branches/SAMBA_3_0/source/utils/ntlm_auth.c 2006-09-01 01:51:54 UTC (rev 17978)
+++ branches/SAMBA_3_0/source/utils/ntlm_auth.c 2006-09-01 04:15:04 UTC (rev 17979)
@@ -2274,6 +2274,37 @@
}
}
+ if (!opt_username || !*opt_username) {
+ x_fprintf(x_stderr, "username must be specified!\n\n");
+ poptPrintHelp(pc, stderr, 0);
+ exit(1);
+ } else {
+ char *domain = SMB_STRDUP(opt_username);
+ char *p = strchr_m(domain, *lp_winbind_separator());
+ if (p) {
+ opt_username = p+1;
+ *p = '\0';
+ if (opt_domain && !strequal(opt_domain, domain)) {
+ x_fprintf(x_stderr, "Domain specified in username (%s) "
+ "doesn't match specified domain (%s)!\n\n",
+ domain, opt_domain);
+ poptPrintHelp(pc, stderr, 0);
+ exit(1);
+ }
+ opt_domain = domain;
+ } else {
+ SAFE_FREE(domain);
+ }
+ }
+
+ if (opt_domain == NULL || !*opt_domain) {
+ opt_domain = get_winbind_domain();
+ }
+
+ if (opt_workstation == NULL) {
+ opt_workstation = "";
+ }
+
if (helper_protocol) {
int i;
for (i=0; i<NUM_HELPER_MODES; i++) {
@@ -2291,20 +2322,6 @@
exit(1);
}
- if (!opt_username) {
- x_fprintf(x_stderr, "username must be specified!\n\n");
- poptPrintHelp(pc, stderr, 0);
- exit(1);
- }
-
- if (opt_domain == NULL) {
- opt_domain = get_winbind_domain();
- }
-
- if (opt_workstation == NULL) {
- opt_workstation = "";
- }
-
if (opt_challenge.length) {
if (!check_auth_crap()) {
exit(1);
Modified: branches/SAMBA_3_0_23/source/utils/ntlm_auth.c
===================================================================
--- branches/SAMBA_3_0_23/source/utils/ntlm_auth.c 2006-09-01 01:51:54 UTC (rev 17978)
+++ branches/SAMBA_3_0_23/source/utils/ntlm_auth.c 2006-09-01 04:15:04 UTC (rev 17979)
@@ -1816,6 +1816,37 @@
}
}
+ if (!opt_username || !*opt_username) {
+ x_fprintf(x_stderr, "username must be specified!\n\n");
+ poptPrintHelp(pc, stderr, 0);
+ exit(1);
+ } else {
+ char *domain = SMB_STRDUP(opt_username);
+ char *p = strchr_m(domain, *lp_winbind_separator());
+ if (p) {
+ opt_username = p+1;
+ *p = '\0';
+ if (opt_domain && !strequal(opt_domain, domain)) {
+ x_fprintf(x_stderr, "Domain specified in username (%s) "
+ "doesn't match specified domain (%s)!\n\n",
+ domain, opt_domain);
+ poptPrintHelp(pc, stderr, 0);
+ exit(1);
+ }
+ opt_domain = domain;
+ } else {
+ SAFE_FREE(domain);
+ }
+ }
+
+ if (opt_domain == NULL || !*opt_domain) {
+ opt_domain = get_winbind_domain();
+ }
+
+ if (opt_workstation == NULL) {
+ opt_workstation = "";
+ }
+
if (helper_protocol) {
int i;
for (i=0; i<NUM_HELPER_MODES; i++) {
@@ -1833,20 +1864,6 @@
exit(1);
}
- if (!opt_username) {
- x_fprintf(x_stderr, "username must be specified!\n\n");
- poptPrintHelp(pc, stderr, 0);
- exit(1);
- }
-
- if (opt_domain == NULL) {
- opt_domain = get_winbind_domain();
- }
-
- if (opt_workstation == NULL) {
- opt_workstation = "";
- }
-
if (opt_challenge.length) {
if (!check_auth_crap()) {
exit(1);
More information about the samba-cvs
mailing list