1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

Ooops - forgot to check the rpcclient and smbcacls compile with the new

code :-(.
Jeremy.
This commit is contained in:
Jeremy Allison 0001-01-01 00:00:00 +00:00
parent 8171cc5642
commit 70beabf73b
5 changed files with 38 additions and 35 deletions

View File

@ -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_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_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_enumprinters( pipes_struct *p, SPOOL_Q_ENUMPRINTERS *q_u, SPOOL_R_ENUMPRINTERS *r_u);
uint32 _spoolss_getprinter(POLICY_HND *handle, uint32 level, uint32 _spoolss_getprinter(pipes_struct *p, SPOOL_Q_GETPRINTER *q_u, SPOOL_R_GETPRINTER *r_u);
NEW_BUFFER *buffer, uint32 offered, uint32 *needed);
uint32 _spoolss_getprinterdriver2(POLICY_HND *handle, const UNISTR2 *uni_arch, uint32 level, uint32 _spoolss_getprinterdriver2(POLICY_HND *handle, const UNISTR2 *uni_arch, uint32 level,
uint32 clientmajorversion, uint32 clientminorversion, uint32 clientmajorversion, uint32 clientminorversion,
NEW_BUFFER *buffer, uint32 offered, NEW_BUFFER *buffer, uint32 offered,

View File

@ -549,7 +549,7 @@ BOOL spoolss_addprinterex(POLICY_HND *hnd, const char* srv_name, PRINTER_INFO_2
strupper(the_client_name); 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", */ /* "Administrator", */
con->pCli_state->user_name, con->pCli_state->user_name,
2, info2); 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); prs_init(&rbuf, 0, 4, mem_ctx, UNMARSHALL);
/* make the ADDPRINTERDRIVER PDU */ /* 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 */ /* turn the data into an io stream */
if (spoolss_io_q_addprinterdriver("", &q_o, &buf, 0) && if (spoolss_io_q_addprinterdriver("", &q_o, &buf, 0) &&

View File

@ -6,6 +6,7 @@
* Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Andrew Tridgell 1992-2000,
* Copyright (C) Luke Kenneth Casson Leighton 1996-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
* Copyright (C) Jean François Micouleau 1998-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 * 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 * 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 * called from the spoolss dispatcher
* *
********************************************************************/ ********************************************************************/
static BOOL api_spoolss_getprinter(pipes_struct *p) static BOOL api_spoolss_getprinter(pipes_struct *p)
{ {
SPOOL_Q_GETPRINTER q_u; SPOOL_Q_GETPRINTER q_u;
@ -328,12 +330,7 @@ static BOOL api_spoolss_getprinter(pipes_struct *p)
return False; return False;
} }
/* that's an [in out] buffer */ r_u.status = _spoolss_getprinter(p, &q_u, &r_u);
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);
if(!spoolss_io_r_getprinter("",&r_u,rdata,0)) { if(!spoolss_io_r_getprinter("",&r_u,rdata,0)) {
DEBUG(0,("spoolss_io_r_getprinter: unable to marshall SPOOL_R_GETPRINTER.\n")); DEBUG(0,("spoolss_io_r_getprinter: unable to marshall SPOOL_R_GETPRINTER.\n"));

View File

@ -6,6 +6,7 @@
* Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Andrew Tridgell 1992-2000,
* Copyright (C) Luke Kenneth Casson Leighton 1996-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
* Copyright (C) Jean François Micouleau 1998-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 * 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 * 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; int snum;
/* that's an [in out] buffer */
new_spoolss_move_buffer(q_u->buffer, &r_u->buffer);
buffer = r_u->buffer;
*needed=0; *needed=0;
if (!get_printer_snum(handle, &snum)) if (!get_printer_snum(handle, &snum))

View File

@ -30,6 +30,7 @@ static pstring owner_username;
static fstring server; static fstring server;
static int got_pass; static int got_pass;
static int test_args; static int test_args;
TALLOC_CTX *ctx;
#define CREATE_ACCESS_READ READ_CONTROL_ACCESS #define CREATE_ACCESS_READ READ_CONTROL_ACCESS
#define CREATE_ACCESS_WRITE (WRITE_DAC_ACCESS | WRITE_OWNER_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_ACL *new;
SEC_ACE *aces; SEC_ACE *aces;
if (! *the_acl) { if (! *the_acl) {
(*the_acl) = make_sec_acl(3, 1, ace); (*the_acl) = make_sec_acl(ctx, 3, 1, ace);
return True; return True;
} }
aces = calloc(1+(*the_acl)->num_aces,sizeof(SEC_ACE)); 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)->ace, (*the_acl)->num_aces * sizeof(SEC_ACE));
memcpy(aces+(*the_acl)->num_aces, ace, 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); new = make_sec_acl(ctx,(*the_acl)->revision,1+(*the_acl)->num_aces, aces);
free_sec_acl(the_acl);
free(aces); free(aces);
(*the_acl) = new; (*the_acl) = new;
return True; return True;
@ -396,11 +396,9 @@ static SEC_DESC *sec_desc_parse(char *str)
return NULL; 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); NULL, dacl, &sd_size);
free_sec_acl(&dacl);
if (grp_sid) free(grp_sid); if (grp_sid) free(grp_sid);
if (owner_sid) free(owner_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); sec_desc_print(stdout, sd);
free_sec_desc(&sd);
cli_close(cli, fnum); cli_close(cli, fnum);
return EXIT_OK; return EXIT_OK;
@ -508,7 +504,7 @@ static int owner_set(struct cli_state *cli, enum chown_mode change_mode,
return EXIT_FAILED; 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_CHOWN) ? &sid : old->owner_sid,
(change_mode == REQUEST_CHGRP) ? &sid : old->grp_sid, (change_mode == REQUEST_CHGRP) ? &sid : old->grp_sid,
NULL, old->dacl, &sd_size); 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)); printf("ERROR: secdesc set failed: %s\n", cli_errstr(cli));
} }
free_sec_desc(&sd);
free_sec_desc(&old);
cli_close(cli, fnum); cli_close(cli, fnum);
return EXIT_OK; return EXIT_OK;
@ -668,20 +661,15 @@ static int cacl_set(struct cli_state *cli, char *filename,
break; break;
case ACL_SET: case ACL_SET:
free_sec_desc(&old);
old = sd; old = sd;
break; break;
} }
if (sd != old) {
free_sec_desc(&sd);
}
/* Denied ACE entries must come before allowed ones */ /* Denied ACE entries must come before allowed ones */
sort_acl(old->dacl); sort_acl(old->dacl);
/* Create new security descriptor and set it */ /* 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); NULL, old->dacl, &sd_size);
fnum = cli_nt_create(cli, filename, CREATE_ACCESS_WRITE); 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 */ /* Clean up */
free_sec_desc(&sd);
free_sec_desc(&old);
cli_close(cli, fnum); cli_close(cli, fnum);
return result; return result;
@ -838,12 +823,15 @@ You can string acls together with spaces, commas or newlines\n\
enum chown_mode change_mode = REQUEST_NONE; enum chown_mode change_mode = REQUEST_NONE;
int result; int result;
ctx=talloc_init();
setlinebuf(stdout); setlinebuf(stdout);
dbf = stderr; dbf = stderr;
if (argc < 3 || argv[1][0] == '-') { if (argc < 3 || argv[1][0] == '-') {
usage(); usage();
talloc_destroy(ctx);
exit(EXIT_PARSE_ERROR); exit(EXIT_PARSE_ERROR);
} }
@ -929,10 +917,12 @@ You can string acls together with spaces, commas or newlines\n\
case 'h': case 'h':
usage(); usage();
talloc_destroy(ctx);
exit(EXIT_PARSE_ERROR); exit(EXIT_PARSE_ERROR);
default: default:
printf("Unknown option %c (%d)\n", (char)opt, opt); printf("Unknown option %c (%d)\n", (char)opt, opt);
talloc_destroy(ctx);
exit(EXIT_PARSE_ERROR); exit(EXIT_PARSE_ERROR);
} }
} }
@ -942,6 +932,7 @@ You can string acls together with spaces, commas or newlines\n\
if (argc > 0) { if (argc > 0) {
usage(); usage();
talloc_destroy(ctx);
exit(EXIT_PARSE_ERROR); exit(EXIT_PARSE_ERROR);
} }
@ -949,7 +940,10 @@ You can string acls together with spaces, commas or newlines\n\
if (!test_args) { if (!test_args) {
cli = connect_one(share); cli = connect_one(share);
if (!cli) exit(EXIT_FAILED); if (!cli) {
talloc_destroy(ctx);
exit(EXIT_FAILED);
}
} }
all_string_sub(filename, "/", "\\", 0); 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); result = cacl_dump(cli, filename);
} }
talloc_destroy(ctx);
return result; return result;
} }