summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-02-28 01:38:12 +0000
committerJeremy Allison <jra@samba.org>2001-02-28 01:38:12 +0000
commit6ed9b52862fa076c26a267ab48df5a097f17edd6 (patch)
tree8b12603d999285c516f8e7239afdf37658dc7b6b
parent403562cb94bc06707f86ec87caf0cf2d32a02ed7 (diff)
downloadsamba-6ed9b52862fa076c26a267ab48df5a097f17edd6.tar.gz
samba-6ed9b52862fa076c26a267ab48df5a097f17edd6.tar.bz2
samba-6ed9b52862fa076c26a267ab48df5a097f17edd6.zip
Ooops - forgot to check the rpcclient and smbcacls compile with the new
code :-(. Jeremy. (This used to be commit 70beabf73bdaad7b6a60e24b7a11798a411bed02)
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/rpc_client/cli_spoolss.c4
-rwxr-xr-xsource3/rpc_server/srv_spoolss.c9
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c17
-rw-r--r--source3/utils/smbcacls.c40
5 files changed, 38 insertions, 35 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 8f0858d4ef..ad16f94000 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -3418,8 +3418,7 @@ uint32 _spoolss_getprinterdata(pipes_struct *p, SPOOL_Q_GETPRINTERDATA *q_u, SPO
uint32 _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNEX *r_u);
uint32 _spoolss_rfnpcnex( pipes_struct *p, SPOOL_Q_RFNPCNEX *q_u, SPOOL_R_RFNPCNEX *r_u);
uint32 _spoolss_enumprinters( pipes_struct *p, SPOOL_Q_ENUMPRINTERS *q_u, SPOOL_R_ENUMPRINTERS *r_u);
-uint32 _spoolss_getprinter(POLICY_HND *handle, uint32 level,
- NEW_BUFFER *buffer, uint32 offered, uint32 *needed);
+uint32 _spoolss_getprinter(pipes_struct *p, SPOOL_Q_GETPRINTER *q_u, SPOOL_R_GETPRINTER *r_u);
uint32 _spoolss_getprinterdriver2(POLICY_HND *handle, const UNISTR2 *uni_arch, uint32 level,
uint32 clientmajorversion, uint32 clientminorversion,
NEW_BUFFER *buffer, uint32 offered,
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 461bddefaf..75e5e66d90 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -549,7 +549,7 @@ BOOL spoolss_addprinterex(POLICY_HND *hnd, const char* srv_name, PRINTER_INFO_2
strupper(the_client_name);
- make_spoolss_q_addprinterex(&q_o, srv_name, the_client_name,
+ make_spoolss_q_addprinterex(mem_ctx, &q_o, srv_name, the_client_name,
/* "Administrator", */
con->pCli_state->user_name,
2, info2);
@@ -791,7 +791,7 @@ uint32 spoolss_addprinterdriver(const char *srv_name, uint32 level, PRINTER_DRIV
prs_init(&rbuf, 0, 4, mem_ctx, UNMARSHALL);
/* make the ADDPRINTERDRIVER PDU */
- make_spoolss_q_addprinterdriver(&q_o, srv_name, level, info);
+ make_spoolss_q_addprinterdriver(mem_ctx, &q_o, srv_name, level, info);
/* turn the data into an io stream */
if (spoolss_io_q_addprinterdriver("", &q_o, &buf, 0) &&
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index 91107e9dbe..4bd70ca755 100755
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -6,6 +6,7 @@
* Copyright (C) Andrew Tridgell 1992-2000,
* Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
* Copyright (C) Jean François Micouleau 1998-2000.
+ * Copyright (C) Jeremy Allison 2001.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -313,6 +314,7 @@ static BOOL api_spoolss_enumprinters(pipes_struct *p)
* called from the spoolss dispatcher
*
********************************************************************/
+
static BOOL api_spoolss_getprinter(pipes_struct *p)
{
SPOOL_Q_GETPRINTER q_u;
@@ -328,12 +330,7 @@ static BOOL api_spoolss_getprinter(pipes_struct *p)
return False;
}
- /* that's an [in out] buffer */
- new_spoolss_move_buffer(q_u.buffer, &r_u.buffer);
-
- r_u.status = _spoolss_getprinter(&q_u.handle, q_u.level,
- r_u.buffer, q_u.offered,
- &r_u.needed);
+ r_u.status = _spoolss_getprinter(p, &q_u, &r_u);
if(!spoolss_io_r_getprinter("",&r_u,rdata,0)) {
DEBUG(0,("spoolss_io_r_getprinter: unable to marshall SPOOL_R_GETPRINTER.\n"));
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 4170700705..0e09bff289 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -6,6 +6,7 @@
* Copyright (C) Andrew Tridgell 1992-2000,
* Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
* Copyright (C) Jean François Micouleau 1998-2000.
+ * Copyright (C) Jeremy Allison 2001.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -3233,11 +3234,21 @@ static uint32 getprinter_level_3(int snum, NEW_BUFFER *buffer, uint32 offered, u
/****************************************************************************
****************************************************************************/
-uint32 _spoolss_getprinter(POLICY_HND *handle, uint32 level,
- NEW_BUFFER *buffer, uint32 offered, uint32 *needed)
+
+uint32 _spoolss_getprinter(pipes_struct *p, SPOOL_Q_GETPRINTER *q_u, SPOOL_R_GETPRINTER *r_u)
{
+ POLICY_HND *handle = &q_u->handle;
+ uint32 level = q_u->level;
+ NEW_BUFFER *buffer = NULL;
+ uint32 offered = q_u->offered;
+ uint32 *needed = &r_u->needed;
+
int snum;
-
+
+ /* that's an [in out] buffer */
+ new_spoolss_move_buffer(q_u->buffer, &r_u->buffer);
+ buffer = r_u->buffer;
+
*needed=0;
if (!get_printer_snum(handle, &snum))
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index b050139aa5..ea4191988a 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -30,6 +30,7 @@ static pstring owner_username;
static fstring server;
static int got_pass;
static int test_args;
+TALLOC_CTX *ctx;
#define CREATE_ACCESS_READ READ_CONTROL_ACCESS
#define CREATE_ACCESS_WRITE (WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS)
@@ -327,15 +328,14 @@ static BOOL add_ace(SEC_ACL **the_acl, SEC_ACE *ace)
SEC_ACL *new;
SEC_ACE *aces;
if (! *the_acl) {
- (*the_acl) = make_sec_acl(3, 1, ace);
+ (*the_acl) = make_sec_acl(ctx, 3, 1, ace);
return True;
}
aces = calloc(1+(*the_acl)->num_aces,sizeof(SEC_ACE));
memcpy(aces, (*the_acl)->ace, (*the_acl)->num_aces * sizeof(SEC_ACE));
memcpy(aces+(*the_acl)->num_aces, ace, sizeof(SEC_ACE));
- new = make_sec_acl((*the_acl)->revision,1+(*the_acl)->num_aces, aces);
- free_sec_acl(the_acl);
+ new = make_sec_acl(ctx,(*the_acl)->revision,1+(*the_acl)->num_aces, aces);
free(aces);
(*the_acl) = new;
return True;
@@ -396,11 +396,9 @@ static SEC_DESC *sec_desc_parse(char *str)
return NULL;
}
- ret = make_sec_desc(revision, owner_sid, grp_sid,
+ ret = make_sec_desc(ctx,revision, owner_sid, grp_sid,
NULL, dacl, &sd_size);
- free_sec_acl(&dacl);
-
if (grp_sid) free(grp_sid);
if (owner_sid) free(owner_sid);
@@ -469,8 +467,6 @@ static int cacl_dump(struct cli_state *cli, char *filename)
sec_desc_print(stdout, sd);
- free_sec_desc(&sd);
-
cli_close(cli, fnum);
return EXIT_OK;
@@ -508,7 +504,7 @@ static int owner_set(struct cli_state *cli, enum chown_mode change_mode,
return EXIT_FAILED;
}
- sd = make_sec_desc(old->revision,
+ sd = make_sec_desc(ctx,old->revision,
(change_mode == REQUEST_CHOWN) ? &sid : old->owner_sid,
(change_mode == REQUEST_CHGRP) ? &sid : old->grp_sid,
NULL, old->dacl, &sd_size);
@@ -524,9 +520,6 @@ static int owner_set(struct cli_state *cli, enum chown_mode change_mode,
printf("ERROR: secdesc set failed: %s\n", cli_errstr(cli));
}
- free_sec_desc(&sd);
- free_sec_desc(&old);
-
cli_close(cli, fnum);
return EXIT_OK;
@@ -668,20 +661,15 @@ static int cacl_set(struct cli_state *cli, char *filename,
break;
case ACL_SET:
- free_sec_desc(&old);
old = sd;
break;
}
- if (sd != old) {
- free_sec_desc(&sd);
- }
-
/* Denied ACE entries must come before allowed ones */
sort_acl(old->dacl);
/* Create new security descriptor and set it */
- sd = make_sec_desc(old->revision, old->owner_sid, old->grp_sid,
+ sd = make_sec_desc(ctx,old->revision, old->owner_sid, old->grp_sid,
NULL, old->dacl, &sd_size);
fnum = cli_nt_create(cli, filename, CREATE_ACCESS_WRITE);
@@ -698,9 +686,6 @@ static int cacl_set(struct cli_state *cli, char *filename,
/* Clean up */
- free_sec_desc(&sd);
- free_sec_desc(&old);
-
cli_close(cli, fnum);
return result;
@@ -838,12 +823,15 @@ You can string acls together with spaces, commas or newlines\n\
enum chown_mode change_mode = REQUEST_NONE;
int result;
+ ctx=talloc_init();
+
setlinebuf(stdout);
dbf = stderr;
if (argc < 3 || argv[1][0] == '-') {
usage();
+ talloc_destroy(ctx);
exit(EXIT_PARSE_ERROR);
}
@@ -929,10 +917,12 @@ You can string acls together with spaces, commas or newlines\n\
case 'h':
usage();
+ talloc_destroy(ctx);
exit(EXIT_PARSE_ERROR);
default:
printf("Unknown option %c (%d)\n", (char)opt, opt);
+ talloc_destroy(ctx);
exit(EXIT_PARSE_ERROR);
}
}
@@ -942,6 +932,7 @@ You can string acls together with spaces, commas or newlines\n\
if (argc > 0) {
usage();
+ talloc_destroy(ctx);
exit(EXIT_PARSE_ERROR);
}
@@ -949,7 +940,10 @@ You can string acls together with spaces, commas or newlines\n\
if (!test_args) {
cli = connect_one(share);
- if (!cli) exit(EXIT_FAILED);
+ if (!cli) {
+ talloc_destroy(ctx);
+ exit(EXIT_FAILED);
+ }
}
all_string_sub(filename, "/", "\\", 0);
@@ -970,5 +964,7 @@ You can string acls together with spaces, commas or newlines\n\
result = cacl_dump(cli, filename);
}
+ talloc_destroy(ctx);
+
return result;
}