[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#260243: marked as done (cupsys-client: make cupsaddsmb accept -U user%password)



Your message dated Fri, 7 Mar 2008 21:56:24 +0100
with message-id <20080307205624.GA17985@piware.de>
and subject line Re: cupsys-client: make cupsaddsmb accept -U user%password
has caused the Debian Bug report #260243,
regarding cupsys-client: make cupsaddsmb accept -U user%password
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
260243: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=260243
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: cupsys-client
Severity: wishlist
Tags: patch

Hi,

It is possible with most of the Samba utils to specify both the user and the password to use when connecting to the server via the -U option, but cupsaddsmb doesn't offer this possibility.

The attached patch makes it possible to specify a login+password pair with the usual -U user%password syntax. It is especially useful when using cupsaddsmb in a script.

Please apply,

JB.

--
Julien BLACHE                                   <jblache@siriustech.org>
Sirius Technologies                          <http://www.siriustech.org>
--- cupsys-1.1.20final+cvs20040330.orig/systemv/cupsaddsmb.c
+++ cupsys-1.1.20final+cvs20040330/systemv/cupsaddsmb.c
@@ -46,8 +46,8 @@
  */
 
 int		Verbosity = 0;
-const char	*SAMBAUser,
-		*SAMBAServer;
+char		*SAMBAUser;
+const char	*SAMBAServer;
 
 
 /*
@@ -80,7 +80,7 @@
 
   export_all = 0;
 
-  SAMBAUser   = cupsUser();
+  SAMBAUser   = strdup(cupsUser());
   SAMBAServer = NULL;
 
   for (i = 1; i < argc; i ++)
@@ -92,7 +92,8 @@
       if (i >= argc)
         usage();
 
-      SAMBAUser = argv[i];
+      free(SAMBAUser);
+      SAMBAUser = strdup(argv[i]);
     }
     else if (strcmp(argv[i], "-H") == 0)
     {
@@ -152,6 +153,8 @@
       return (status);
   }
 
+  free(SAMBAUser);
+
   return (0);
 }
 
@@ -167,19 +170,27 @@
 {
   int		status;			/* Status of command */
   char		temp[4096];		/* Command/prompt string */
-  static const char *p = NULL;		/* Password data */
+  static char   *p = NULL;		/* Password data */
 
 
   for (status = 1;;)
   {
     if (p == NULL)
     {
-      snprintf(temp, sizeof(temp),
-               "Password for %s required to access %s via SAMBA: ",
-	       SAMBAUser, SAMBAServer);
-
-      if ((p = cupsGetPassword(temp)) == NULL)
-	break;
+      if ((p = strchr(SAMBAUser, '%')) != NULL)
+	{
+	  *p = '\0';
+	  p++;
+	}
+      else
+	{
+	  snprintf(temp, sizeof(temp),
+		   "Password for %s required to access %s via SAMBA: ",
+		   SAMBAUser, SAMBAServer);
+
+	  if ((p = cupsGetPassword(temp)) == NULL)
+	    break;
+	}
     }
 
     snprintf(temp, sizeof(temp), "%s -N -U\'%s%%%s\' -c \'%s\'",

--- End Message ---
--- Begin Message ---
Hi,

this has been fixed ages ago in cupsys 1.2. Closing.

Thank you!

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


--- End Message ---

Reply to: