diff options
author | Jeremy Allison <jra@samba.org> | 2007-11-08 18:50:07 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-11-08 18:50:07 -0800 |
commit | 5f4693d8f8cf435cb2c62787ba95acf2b0b5f7d2 (patch) | |
tree | 60266dd6290b88f233a7905ead866b6bea4839a5 /source3/client | |
parent | 7f97c6b96c5f7589a2d66b82bd6c6de1f0170e5a (diff) | |
download | samba-5f4693d8f8cf435cb2c62787ba95acf2b0b5f7d2.tar.gz samba-5f4693d8f8cf435cb2c62787ba95acf2b0b5f7d2.tar.bz2 samba-5f4693d8f8cf435cb2c62787ba95acf2b0b5f7d2.zip |
Remove more pstring/fstrings.
Jeremy.
(This used to be commit 7a1de5b44e84a7474e78518c6ba33b3fedc42b5f)
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/smbspool.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c index 5a1556bd70..0ba4d57ff5 100644 --- a/source3/client/smbspool.c +++ b/source3/client/smbspool.c @@ -69,11 +69,12 @@ static char * uri_unescape_alloc(const char *); *printer; /* Printer name */ const char *workgroup; /* Workgroup */ FILE *fp; /* File to print */ - int status=0; /* Status of LPD job */ + int status=1; /* Status of LPD job */ struct cli_state *cli; /* SMB interface */ char null_str[1]; int tries = 0; const char *dev_uri; + TALLOC_CTX *frame = talloc_stackframe(); null_str[0] = '\0'; @@ -93,7 +94,8 @@ static char * uri_unescape_alloc(const char *); */ list_devices(); - return (0); + status = 0; + goto done; } if (argc < 6 || argc > 7) @@ -104,7 +106,7 @@ static char * uri_unescape_alloc(const char *); fputs(" destination printer:\n", stderr); fputs("\n", stderr); fputs(" smb://[username:password@][workgroup/]server[:port]/printer\n", stderr); - return (1); + goto done; } /* @@ -125,7 +127,7 @@ static char * uri_unescape_alloc(const char *); else if ((fp = fopen(argv[6], "rb")) == NULL) { perror("ERROR: Unable to open print file"); - return (1); + goto done; } else copies = atoi(argv[4]); @@ -142,7 +144,7 @@ static char * uri_unescape_alloc(const char *); else { fputs("ERROR: No device URI found in DEVICE_URI environment variable or argv[0] !\n", stderr); - return (1); + goto done; } uri[sizeof(uri) - 1] = '\0'; @@ -184,7 +186,7 @@ static char * uri_unescape_alloc(const char *); if ((sep = strchr_m(tmp, '/')) == NULL) { fputs("ERROR: Bad URI - need printer name!\n", stderr); - return (1); + goto done; } *sep++ = '\0'; @@ -231,7 +233,7 @@ static char * uri_unescape_alloc(const char *); if (!lp_load(dyn_CONFIGFILE, True, False, False, True)) { fprintf(stderr, "ERROR: Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE); - return (1); + goto done; } if (workgroup == NULL) @@ -252,7 +254,7 @@ static char * uri_unescape_alloc(const char *); else { fprintf(stderr, "ERROR: Unable to connect to CIFS host, trying next printer...\n"); - return (1); + goto done; } } } @@ -260,7 +262,7 @@ static char * uri_unescape_alloc(const char *); if (cli == NULL) { fprintf(stderr, "ERROR: Unable to connect to CIFS host after (tried %d times)\n", tries); - return (1); + goto done; } /* @@ -287,6 +289,9 @@ static char * uri_unescape_alloc(const char *); * Return the queue status... */ + done: + + TALLOC_FREE(frame); return (status); } @@ -480,14 +485,17 @@ smb_connect(const char *workgroup, /* I - Workgroup */ const char *jobusername) /* I - User who issued the print job */ { struct cli_state *cli; /* New connection */ - pstring myname; /* Client name */ + char *myname = NULL; /* Client name */ struct passwd *pwd; /* * Get the names and addresses of the client and server... */ - get_myname(myname); + myname = get_myname(talloc_tos()); + if (!myname) { + return NULL; + } /* See if we have a username first. This is for backwards compatible behavior with 3.0.14a */ |