summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-05-30 11:59:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:51 -0500
commite4952bf5903ee65b135f781c4a679aea4eb25974 (patch)
treedb1522fd681843a8d76d7305ef24519b6977821d
parente003407584a82bd9752b7191f1ed27b5e89e524c (diff)
downloadsamba-e4952bf5903ee65b135f781c4a679aea4eb25974.tar.gz
samba-e4952bf5903ee65b135f781c4a679aea4eb25974.tar.bz2
samba-e4952bf5903ee65b135f781c4a679aea4eb25974.zip
r947: Patch from Fabian Franz <FabianFranz@gmx.de> that allows you
to specify a port in the device URL. (This used to be commit e6dcda2b10c4871ca8488bf04b22c2c11673621d)
-rw-r--r--source3/client/smbspool.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 5daefec5a5..a67ccadb90 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -36,7 +36,7 @@ extern BOOL in_client; /* Boolean for client library */
*/
static void list_devices(void);
-static struct cli_state *smb_connect(const char *, const char *, const char *, const char *, const char *);
+static struct cli_state *smb_connect(const char *, const char *, int, const char *, const char *, const char *);
static int smb_print(struct cli_state *, char *, FILE *);
@@ -50,6 +50,7 @@ static int smb_print(struct cli_state *, char *, FILE *);
{
int i; /* Looping var */
int copies; /* Number of copies */
+ int port; /* Port number */
char uri[1024], /* URI */
*sep, /* Pointer to separator */
*password; /* Password */
@@ -87,7 +88,7 @@ static int smb_print(struct cli_state *, char *, FILE *);
fputs(" The DEVICE_URI environment variable can also contain the\n", stderr);
fputs(" destination printer:\n", stderr);
fputs("\n", stderr);
- fputs(" smb://[username:password@][workgroup/]server/printer\n", stderr);
+ fputs(" smb://[username:password@][workgroup/]server[:port]/printer\n", stderr);
return (1);
}
@@ -179,7 +180,17 @@ static int smb_print(struct cli_state *, char *, FILE *);
}
else
workgroup = NULL;
+
+ if ((sep = strrchr_m(server, ':')) != NULL)
+ {
+ *sep++ = '\0';
+ port=atoi(sep);
+ }
+ else
+ port=0;
+
+
/*
* Setup the SAMBA server state...
*/
@@ -201,7 +212,7 @@ static int smb_print(struct cli_state *, char *, FILE *);
do
{
- if ((cli = smb_connect(workgroup, server, printer, username, password)) == NULL)
+ if ((cli = smb_connect(workgroup, server, port, printer, username, password)) == NULL)
{
if (getenv("CLASS") == NULL)
{
@@ -267,6 +278,7 @@ list_devices(void)
static struct cli_state * /* O - SMB connection */
smb_connect(const char *workgroup, /* I - Workgroup */
const char *server, /* I - Server */
+ const int port, /* I - Port */
const char *share, /* I - Printer */
const char *username, /* I - Username */
const char *password) /* I - Password */
@@ -281,7 +293,7 @@ smb_connect(const char *workgroup, /* I - Workgroup */
get_myname(myname);
- nt_status = cli_full_connection(&c, myname, server, NULL, 0, share, "?????",
+ nt_status = cli_full_connection(&c, myname, server, NULL, port, share, "?????",
username, workgroup, password, 0, Undefined, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {