update the patch to the current one I posted to bugzilla.samba.org
This commit is contained in:
parent
019e0ee6ef
commit
fa0bbbc00f
@ -2,30 +2,38 @@ Index: source/client/client.c
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- source/client/client.c (revision 21918)
|
--- source/client/client.c (revision 21918)
|
||||||
+++ source/client/client.c (working copy)
|
+++ source/client/client.c (working copy)
|
||||||
@@ -3847,6 +3847,7 @@
|
@@ -3847,6 +3847,8 @@
|
||||||
char *p;
|
char *p;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
fstring new_workgroup;
|
fstring new_workgroup;
|
||||||
+ BOOL first_opt = True;
|
+ BOOL tar_opt = False;
|
||||||
|
+ BOOL service_opt = False;
|
||||||
struct poptOption long_options[] = {
|
struct poptOption long_options[] = {
|
||||||
POPT_AUTOHELP
|
POPT_AUTOHELP
|
||||||
|
|
||||||
@@ -3900,6 +3901,44 @@
|
@@ -3899,7 +3901,42 @@
|
||||||
|
|
||||||
in_client = True; /* Make sure that we tell lp_load we are */
|
in_client = True; /* Make sure that we tell lp_load we are */
|
||||||
|
|
||||||
while ((opt = poptGetNextOpt(pc)) != -1) {
|
- while ((opt = poptGetNextOpt(pc)) != -1) {
|
||||||
|
+ /* let's fetch the first opt, this will fetch also arg0 (program name) which we will skip
|
||||||
|
+ * and eventually the service and the password */
|
||||||
|
+ opt = poptGetNextOpt(pc);
|
||||||
+
|
+
|
||||||
+ /* bad hack to cope with the breackage the -T option would cause
|
+ /* skip argv 0, (program name) */
|
||||||
+ * by eating the wrong arguments. We need to eat arg 0,[1,2] before */
|
+ poptGetArg(pc);
|
||||||
+ if (first_opt) {
|
|
||||||
+ int argind = 0;
|
|
||||||
+ while (poptPeekArg(pc)) {
|
|
||||||
+ switch(argind) {
|
|
||||||
+ case 0: /* progname */
|
|
||||||
+ poptGetArg(pc); /* skip */
|
|
||||||
+ break;
|
|
||||||
+
|
+
|
||||||
+ case 1: /* service name */
|
+ do {
|
||||||
|
+ /* this check is needed to insure that the -T tar option is forcibly the last one */
|
||||||
|
+ /* I see no other way to keep things sane --SSS */
|
||||||
|
+ if (tar_opt == True) {
|
||||||
|
+ d_printf("ERROR: the tar option -T MUST be the last option specified on the command line\n");
|
||||||
|
+ poptPrintUsage(pc, stderr, 0);
|
||||||
|
+ exit(-1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* if the service has not yet been specified lets see if it is available in the popt stack */
|
||||||
|
+ if (!service_opt && poptPeekArg(pc)) {
|
||||||
+ pstrcpy(service, poptGetArg(pc));
|
+ pstrcpy(service, poptGetArg(pc));
|
||||||
+ /* Convert any '/' characters in the service name to '\' characters */
|
+ /* Convert any '/' characters in the service name to '\' characters */
|
||||||
+ string_replace(service, '/','\\');
|
+ string_replace(service, '/','\\');
|
||||||
@ -35,45 +43,47 @@ Index: source/client/client.c
|
|||||||
+ poptPrintUsage(pc, stderr, 0);
|
+ poptPrintUsage(pc, stderr, 0);
|
||||||
+ exit(1);
|
+ exit(1);
|
||||||
+ }
|
+ }
|
||||||
+ break;
|
+ service_opt = True;
|
||||||
+ case 2: /* command line provided password */
|
+ }
|
||||||
+ cmdline_auth_info.got_pass = True;
|
|
||||||
+ pstrcpy(cmdline_auth_info.password,poptGetArg(pc));
|
|
||||||
+ break;
|
|
||||||
+
|
+
|
||||||
+ default:
|
+ /* if the service has already been retrieved then check if we have also a password */
|
||||||
+ /* uh? garbage? */
|
+ if (service_opt && (!cmdline_auth_info.got_pass) && poptPeekArg(pc)) {
|
||||||
+ d_printf("\nUnknown option: [%s]!\n", poptGetArg(pc));
|
+ pstrcpy(cmdline_auth_info.password, poptGetArg(pc));
|
||||||
+ poptPrintUsage(pc, stderr, 0);
|
+ cmdline_auth_info.got_pass = True;
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+ argind++;
|
|
||||||
+ }
|
|
||||||
+ first_opt = False;
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'M':
|
case 'M':
|
||||||
/* Messages are sent to NetBIOS name type 0x3
|
/* Messages are sent to NetBIOS name type 0x3
|
||||||
@@ -3959,7 +3998,7 @@
|
@@ -3954,13 +3991,9 @@
|
||||||
*/
|
poptPrintUsage(pc, stderr, 0);
|
||||||
optnum -= i;
|
exit(1);
|
||||||
for (i = 0; i < optnum; i++)
|
|
||||||
- poptGetOptArg(pc);
|
|
||||||
+ poptGetArg(pc);
|
|
||||||
}
|
}
|
||||||
|
- /* Now we must eat (optnum - i) options - they have
|
||||||
|
- * been processed by tar_parseargs().
|
||||||
|
- */
|
||||||
|
- optnum -= i;
|
||||||
|
- for (i = 0; i < optnum; i++)
|
||||||
|
- poptGetOptArg(pc);
|
||||||
|
}
|
||||||
|
+ /* this must be the last option, mark we have parsed it so that we know we have */
|
||||||
|
+ tar_opt = True;
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
@@ -3971,8 +4010,6 @@
|
pstrcpy(base_directory,poptGetOptArg(pc));
|
||||||
}
|
@@ -3969,10 +4002,8 @@
|
||||||
|
grepable=True;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
- }
|
||||||
|
+ } while ((opt = poptGetNextOpt(pc)) != -1);
|
||||||
|
|
||||||
- poptGetArg(pc);
|
- poptGetArg(pc);
|
||||||
-
|
-
|
||||||
/* check for the -P option */
|
/* check for the -P option */
|
||||||
|
|
||||||
if ( port != 0 )
|
if ( port != 0 )
|
||||||
@@ -4011,23 +4048,6 @@
|
@@ -4011,23 +4042,6 @@
|
||||||
else
|
else
|
||||||
pstrcpy( calling_name, global_myname() );
|
pstrcpy( calling_name, global_myname() );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user