summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cli_spoolss.c56
-rw-r--r--source3/libsmb/cliconnect.c2
-rw-r--r--source3/libsmb/pwd_cache.c10
3 files changed, 35 insertions, 33 deletions
diff --git a/source3/libsmb/cli_spoolss.c b/source3/libsmb/cli_spoolss.c
index d8e7b0cce6..af12f102d7 100644
--- a/source3/libsmb/cli_spoolss.c
+++ b/source3/libsmb/cli_spoolss.c
@@ -25,7 +25,6 @@
#include "includes.h"
/* Opens a SMB connection to the SPOOLSS pipe */
-
struct cli_state *cli_spoolss_initialise(struct cli_state *cli,
char *system_name,
struct ntuser_creds *creds)
@@ -321,10 +320,14 @@ uint32 cli_spoolss_enum_printers(struct cli_state *cli, uint32 flags,
NEW_BUFFER buffer;
uint32 needed = 100;
uint32 result;
+ fstring server;
ZERO_STRUCT(q);
ZERO_STRUCT(r);
+ fstrcpy (server, cli->desthost);
+ strupper (server);
+
do {
/* Initialise input parameters */
@@ -333,46 +336,39 @@ uint32 cli_spoolss_enum_printers(struct cli_state *cli, uint32 flags,
prs_init(&qbuf, MAX_PDU_FRAG_LEN, cli->mem_ctx, MARSHALL);
prs_init(&rbuf, 0, cli->mem_ctx, UNMARSHALL);
- make_spoolss_q_enumprinters(&q, flags, "", level, &buffer,
+ make_spoolss_q_enumprinters(&q, flags, server, level, &buffer,
needed);
/* Marshall data and send request */
if (!spoolss_io_q_enumprinters("", &q, &qbuf, 0) ||
- !rpc_api_pipe_req(cli, SPOOLSS_ENUMPRINTERS, &qbuf,
- &rbuf)) {
+ !rpc_api_pipe_req(cli, SPOOLSS_ENUMPRINTERS, &qbuf, &rbuf)) {
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
/* Unmarshall response */
-
- prs_switch_type(&buffer.prs, UNMARSHALL);
- prs_set_offset(&buffer.prs, 0);
- r.buffer = &buffer;
-
if (new_spoolss_io_r_enumprinters("", &r, &rbuf, 0)) {
needed = r.needed;
}
/* Return output parameters */
- if ((result = r.status) == NT_STATUS_NOPROBLEMO &&
- r.returned > 0) {
+ if ((result = r.status) == NT_STATUS_NOPROBLEMO && r.returned > 0) {
*returned = r.returned;
switch (level) {
case 1:
- decode_printer_info_1(&buffer, r.returned,
+ decode_printer_info_1(r.buffer, r.returned,
&ctr->printers_1);
break;
case 2:
- decode_printer_info_2(&buffer, r.returned,
+ decode_printer_info_2(r.buffer, r.returned,
&ctr->printers_2);
break;
case 3:
- decode_printer_info_3(&buffer, r.returned,
+ decode_printer_info_3(r.buffer, r.returned,
&ctr->printers_3);
break;
}
@@ -398,10 +394,14 @@ uint32 cli_spoolss_enum_ports(struct cli_state *cli, uint32 level,
NEW_BUFFER buffer;
uint32 needed = 100;
uint32 result;
+ fstring server;
ZERO_STRUCT(q);
ZERO_STRUCT(r);
+ fstrcpy (server, cli->desthost);
+ strupper (server);
+
do {
/* Initialise input parameters */
@@ -410,23 +410,20 @@ uint32 cli_spoolss_enum_ports(struct cli_state *cli, uint32 level,
prs_init(&qbuf, MAX_PDU_FRAG_LEN, cli->mem_ctx, MARSHALL);
prs_init(&rbuf, 0, cli->mem_ctx, UNMARSHALL);
+ /* NT4 will return NT_STATUS_CTL_FILE_NOT_SUPPORTED is we
+ set the servername here in the query. Not sure why \
+ --jerry */
make_spoolss_q_enumports(&q, "", level, &buffer, needed);
/* Marshall data and send request */
if (!spoolss_io_q_enumports("", &q, &qbuf, 0) ||
- !rpc_api_pipe_req(cli, SPOOLSS_ENUMPORTS, &qbuf,
- &rbuf)) {
+ !rpc_api_pipe_req(cli, SPOOLSS_ENUMPORTS, &qbuf, &rbuf)) {
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
/* Unmarshall response */
-
- prs_switch_type(&buffer.prs, UNMARSHALL);
- prs_set_offset(&buffer.prs, 0);
- r.buffer = &buffer;
-
if (new_spoolss_io_r_enumports("", &r, &rbuf, 0)) {
needed = r.needed;
}
@@ -440,11 +437,11 @@ uint32 cli_spoolss_enum_ports(struct cli_state *cli, uint32 level,
switch (level) {
case 1:
- decode_port_info_1(&buffer, r.returned,
+ decode_port_info_1(r.buffer, r.returned,
&ctr->port.info_1);
break;
case 2:
- decode_port_info_2(&buffer, r.returned,
+ decode_port_info_2(r.buffer, r.returned,
&ctr->port.info_2);
break;
}
@@ -495,11 +492,6 @@ uint32 cli_spoolss_getprinter(struct cli_state *cli, POLICY_HND *pol,
}
/* Unmarshall response */
-
- prs_switch_type(&buffer.prs, UNMARSHALL);
- prs_set_offset(&buffer.prs, 0);
- r.buffer = &buffer;
-
if (spoolss_io_r_getprinter("", &r, &rbuf, 0)) {
needed = r.needed;
}
@@ -510,19 +502,19 @@ uint32 cli_spoolss_getprinter(struct cli_state *cli, POLICY_HND *pol,
switch (level) {
case 0:
- decode_printer_info_0(&buffer, 1,
+ decode_printer_info_0(r.buffer, 1,
&ctr->printers_0);
break;
case 1:
- decode_printer_info_1(&buffer, 1,
+ decode_printer_info_1(r.buffer, 1,
&ctr->printers_1);
break;
case 2:
- decode_printer_info_2(&buffer, 1,
+ decode_printer_info_2(r.buffer, 1,
&ctr->printers_2);
break;
case 3:
- decode_printer_info_3(&buffer, 1,
+ decode_printer_info_3(r.buffer, 1,
&ctr->printers_3);
break;
}
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 46a63dc5f1..06f283c321 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -669,7 +669,7 @@ BOOL cli_establish_connection(struct cli_state *cli,
{
DEBUG(1,("failed session request\n"));
if (do_shutdown)
- cli_shutdown(cli);
+ cli_shutdown(cli);
return False;
}
diff --git a/source3/libsmb/pwd_cache.c b/source3/libsmb/pwd_cache.c
index 26b1d192f0..420b49ed2e 100644
--- a/source3/libsmb/pwd_cache.c
+++ b/source3/libsmb/pwd_cache.c
@@ -103,11 +103,21 @@ void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt)
user_pass = (char*)getpass(passwd_report);
+ /*
+ * Do not assume that an empty string is a NULL password.
+ * If you do this will break the session key generation for
+ * and account with an emtpy password. If you wish to use
+ * a NULL password, use the -N option to smbclient and rpcclient
+ * --jerry
+ */
+#if 0
if (user_pass == NULL || user_pass[0] == 0)
{
pwd_set_nullpwd(pwd);
}
else if (do_encrypt)
+#endif
+ if (do_encrypt)
{
pwd_make_lm_nt_16(pwd, user_pass);
}