2007-03-26 21:29:00 +00:00
|
|
|
Index: source/client/client.c
|
|
|
|
===================================================================
|
2007-03-27 21:57:33 +00:00
|
|
|
--- source/client/client.c (revision 21990)
|
2007-03-26 21:29:00 +00:00
|
|
|
+++ source/client/client.c (working copy)
|
2007-03-27 15:20:32 +00:00
|
|
|
@@ -3847,6 +3847,8 @@
|
2007-03-26 21:29:00 +00:00
|
|
|
char *p;
|
|
|
|
int rc = 0;
|
|
|
|
fstring new_workgroup;
|
2007-03-27 15:20:32 +00:00
|
|
|
+ BOOL tar_opt = False;
|
|
|
|
+ BOOL service_opt = False;
|
2007-03-26 21:29:00 +00:00
|
|
|
struct poptOption long_options[] = {
|
|
|
|
POPT_AUTOHELP
|
|
|
|
|
2007-03-27 21:57:33 +00:00
|
|
|
@@ -3893,13 +3895,43 @@
|
|
|
|
x_setbuf( dbf, NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
- pc = poptGetContext("smbclient", argc, (const char **) argv, long_options,
|
|
|
|
- POPT_CONTEXT_KEEP_FIRST);
|
|
|
|
+ /* skip argv(0) */
|
|
|
|
+ pc = poptGetContext("smbclient", argc, (const char **) argv, long_options, 0);
|
|
|
|
poptSetOtherOptionHelp(pc, "service <password>");
|
2007-03-27 15:20:32 +00:00
|
|
|
|
2007-03-26 21:29:00 +00:00
|
|
|
in_client = True; /* Make sure that we tell lp_load we are */
|
|
|
|
|
2007-03-27 21:57:33 +00:00
|
|
|
while ((opt = poptGetNextOpt(pc)) != -1) {
|
2007-03-26 21:29:00 +00:00
|
|
|
+
|
2007-03-27 21:57:33 +00:00
|
|
|
+ /* if the tar option has been called previouslt, now we need to eat out the leftovers */
|
2007-03-27 15:20:32 +00:00
|
|
|
+ /* I see no other way to keep things sane --SSS */
|
|
|
|
+ if (tar_opt == True) {
|
2007-03-27 21:57:33 +00:00
|
|
|
+ while (poptPeekArg(pc)) {
|
|
|
|
+ poptGetArg(pc);
|
|
|
|
+ }
|
|
|
|
+ tar_opt = False;
|
2007-03-27 15:20:32 +00:00
|
|
|
+ }
|
2007-03-26 21:29:00 +00:00
|
|
|
+
|
2007-03-27 15:20:32 +00:00
|
|
|
+ /* 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));
|
|
|
|
+ /* Convert any '/' characters in the service name to '\' characters */
|
|
|
|
+ string_replace(service, '/','\\');
|
2007-03-26 21:29:00 +00:00
|
|
|
+
|
2007-03-27 15:20:32 +00:00
|
|
|
+ if (count_chars(service,'\\') < 3) {
|
|
|
|
+ d_printf("\n%s: Not enough '\\' characters in service\n",service);
|
|
|
|
+ poptPrintUsage(pc, stderr, 0);
|
|
|
|
+ exit(1);
|
2007-03-26 21:29:00 +00:00
|
|
|
+ }
|
2007-03-27 15:20:32 +00:00
|
|
|
+ service_opt = True;
|
2007-03-26 21:29:00 +00:00
|
|
|
+ }
|
|
|
|
+
|
2007-03-27 15:20:32 +00:00
|
|
|
+ /* if the service has already been retrieved then check if we have also a password */
|
|
|
|
+ if (service_opt && (!cmdline_auth_info.got_pass) && poptPeekArg(pc)) {
|
|
|
|
+ pstrcpy(cmdline_auth_info.password, poptGetArg(pc));
|
|
|
|
+ cmdline_auth_info.got_pass = True;
|
|
|
|
+ }
|
|
|
|
+
|
2007-03-26 21:29:00 +00:00
|
|
|
switch (opt) {
|
|
|
|
case 'M':
|
|
|
|
/* Messages are sent to NetBIOS name type 0x3
|
2007-03-27 21:57:33 +00:00
|
|
|
@@ -3954,13 +3986,9 @@
|
2007-03-27 15:20:32 +00:00
|
|
|
poptPrintUsage(pc, stderr, 0);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
- /* Now we must eat (optnum - i) options - they have
|
|
|
|
- * been processed by tar_parseargs().
|
|
|
|
- */
|
|
|
|
- optnum -= i;
|
|
|
|
- for (i = 0; i < optnum; i++)
|
2007-03-26 21:29:00 +00:00
|
|
|
- poptGetOptArg(pc);
|
|
|
|
}
|
2007-03-27 15:20:32 +00:00
|
|
|
+ /* this must be the last option, mark we have parsed it so that we know we have */
|
|
|
|
+ tar_opt = True;
|
2007-03-26 21:29:00 +00:00
|
|
|
break;
|
|
|
|
case 'D':
|
2007-03-27 15:20:32 +00:00
|
|
|
pstrcpy(base_directory,poptGetOptArg(pc));
|
2007-03-27 21:57:33 +00:00
|
|
|
@@ -3971,8 +3999,34 @@
|
2007-03-26 21:29:00 +00:00
|
|
|
}
|
2007-03-27 21:57:33 +00:00
|
|
|
}
|
2007-03-26 21:29:00 +00:00
|
|
|
|
|
|
|
- poptGetArg(pc);
|
2007-03-27 21:57:33 +00:00
|
|
|
+ /* We may still have some leftovers after the last popt option has been called */
|
|
|
|
+ if (tar_opt == True) {
|
|
|
|
+ while (poptPeekArg(pc)) {
|
|
|
|
+ poptGetArg(pc);
|
|
|
|
+ }
|
|
|
|
+ tar_opt = False;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /* 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));
|
|
|
|
+ /* Convert any '/' characters in the service name to '\' characters */
|
|
|
|
+ string_replace(service, '/','\\');
|
|
|
|
+
|
|
|
|
+ if (count_chars(service,'\\') < 3) {
|
|
|
|
+ d_printf("\n%s: Not enough '\\' characters in service\n",service);
|
|
|
|
+ poptPrintUsage(pc, stderr, 0);
|
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
+ service_opt = True;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* if the service has already been retrieved then check if we have also a password */
|
|
|
|
+ if (service_opt && (!cmdline_auth_info.got_pass) && poptPeekArg(pc)) {
|
|
|
|
+ pstrcpy(cmdline_auth_info.password, poptGetArg(pc));
|
|
|
|
+ cmdline_auth_info.got_pass = True;
|
|
|
|
+ }
|
|
|
|
+
|
2007-03-26 21:29:00 +00:00
|
|
|
/* check for the -P option */
|
|
|
|
|
|
|
|
if ( port != 0 )
|
2007-03-27 21:57:33 +00:00
|
|
|
@@ -4011,23 +4065,6 @@
|
2007-03-26 21:29:00 +00:00
|
|
|
else
|
|
|
|
pstrcpy( calling_name, global_myname() );
|
|
|
|
|
|
|
|
- if(poptPeekArg(pc)) {
|
|
|
|
- pstrcpy(service,poptGetArg(pc));
|
|
|
|
- /* Convert any '/' characters in the service name to '\' characters */
|
|
|
|
- string_replace(service, '/','\\');
|
|
|
|
-
|
|
|
|
- if (count_chars(service,'\\') < 3) {
|
|
|
|
- d_printf("\n%s: Not enough '\\' characters in service\n",service);
|
|
|
|
- poptPrintUsage(pc, stderr, 0);
|
|
|
|
- exit(1);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (poptPeekArg(pc) && !cmdline_auth_info.got_pass) {
|
|
|
|
- cmdline_auth_info.got_pass = True;
|
|
|
|
- pstrcpy(cmdline_auth_info.password,poptGetArg(pc));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
init_names();
|
|
|
|
|
|
|
|
if(new_name_resolve_order)
|