summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorbubulle <bubulle@alioth.debian.org>2010-01-10 17:48:14 +0000
committerbubulle <bubulle@alioth.debian.org>2010-01-10 17:48:14 +0000
commit24d327ba0fd0f6c9192bb77c4423d6864b5421e4 (patch)
treea759ceae640d8cda02dc766b4b2e1e4cdff1457c /source3/rpc_server
parent33602026cf4cce11e018cffe3ddcb352250da1b9 (diff)
downloadsamba-24d327ba0fd0f6c9192bb77c4423d6864b5421e4.tar.gz
merge upstream 3.4.4~dfsg
git-svn-id: svn://svn.debian.org/svn/pkg-samba/trunk/samba@3218 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_samr_nt.c10
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c42
2 files changed, 40 insertions, 12 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index a608f16726..ce67759d8a 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -3042,7 +3042,7 @@ NTSTATUS _samr_QueryUserInfo(pipes_struct *p,
uint32 rid;
bool ret = false;
struct samu *pwd = NULL;
- uint32_t acc_required, acc_granted;
+ uint32_t acc_required, acc_granted = 0;
/* search for the handle */
if (!find_policy_by_hnd(p, r->in.user_handle, (void **)(void *)&info))
@@ -5390,6 +5390,14 @@ NTSTATUS _samr_GetAliasMembership(pipes_struct *p,
r->out.rids->count = num_alias_rids;
r->out.rids->ids = alias_rids;
+ if (r->out.rids->ids == NULL) {
+ /* Windows domain clients don't accept a NULL ptr here */
+ r->out.rids->ids = talloc_zero(p->mem_ctx, uint32_t);
+ }
+ if (r->out.rids->ids == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
return NT_STATUS_OK;
}
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 87735d330b..e88c73304b 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -1670,6 +1670,10 @@ WERROR _spoolss_OpenPrinterEx(pipes_struct *p,
return WERR_BADFID;
}
+ if (r->in.access_mask == SEC_FLAG_MAXIMUM_ALLOWED) {
+ r->in.access_mask = PRINTER_ACCESS_ADMINISTER;
+ }
+
se_map_standard(&r->in.access_mask, &printer_std_mapping);
/* map an empty access mask to the minimum access mask */
@@ -9259,7 +9263,7 @@ WERROR _spoolss_EnumPrinterKey(pipes_struct *p,
WERROR result = WERR_BADFILE;
int i;
const char **array = NULL;
-
+ DATA_BLOB blob;
DEBUG(4,("_spoolss_EnumPrinterKey\n"));
@@ -9288,37 +9292,53 @@ WERROR _spoolss_EnumPrinterKey(pipes_struct *p,
goto done;
}
- *r->out.needed = 4;
-
- array = talloc_zero_array(r->out.key_buffer, const char *, num_keys + 1);
+ array = talloc_zero_array(r->out.key_buffer, const char *, num_keys + 2);
if (!array) {
result = WERR_NOMEM;
goto done;
}
+ if (!num_keys) {
+ array[0] = talloc_strdup(array, "");
+ if (!array[0]) {
+ result = WERR_NOMEM;
+ goto done;
+ }
+ }
+
for (i=0; i < num_keys; i++) {
+
+ DEBUG(10,("_spoolss_EnumPrinterKey: adding keyname: %s\n",
+ keynames[i]));
+
array[i] = talloc_strdup(array, keynames[i]);
if (!array[i]) {
result = WERR_NOMEM;
goto done;
}
-
- *r->out.needed += strlen_m_term(keynames[i]) * 2;
}
- if (r->in.offered < *r->out.needed) {
- result = WERR_MORE_DATA;
+ if (!push_reg_multi_sz(p->mem_ctx, &blob, array)) {
+ result = WERR_NOMEM;
goto done;
}
- result = WERR_OK;
+ *r->out._ndr_size = r->in.offered / 2;
+ *r->out.needed = blob.length;
- *r->out.key_buffer = array;
+ if (r->in.offered < *r->out.needed) {
+ result = WERR_MORE_DATA;
+ } else {
+ result = WERR_OK;
+ r->out.key_buffer->string_array = array;
+ }
done:
if (!W_ERROR_IS_OK(result)) {
TALLOC_FREE(array);
- ZERO_STRUCTP(r->out.key_buffer);
+ if (!W_ERROR_EQUAL(result, WERR_MORE_DATA)) {
+ *r->out.needed = 0;
+ }
}
free_a_printer(&printer, 2);