Ooops - forgot to check the rpcclient and smbcacls compile with the new
authorJeremy Allison <jra@samba.org>
Wed, 28 Feb 2001 01:38:12 +0000 (01:38 +0000)
committerJeremy Allison <jra@samba.org>
Wed, 28 Feb 2001 01:38:12 +0000 (01:38 +0000)
code :-(.
Jeremy.
(This used to be commit 70beabf73bdaad7b6a60e24b7a11798a411bed02)

source3/include/proto.h
source3/rpc_client/cli_spoolss.c
source3/rpc_server/srv_spoolss.c
source3/rpc_server/srv_spoolss_nt.c
source3/utils/smbcacls.c

index 8f0858d4ef523af953f1db41d9f7119f25d9b9d7..ad16f9400009c5b51f31b25405945973af1fd9c6 100644 (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_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,
index 461bddefaf81eda008836caaba80a80826123232..75e5e66d90a6f11dcb866e9bc864509ea9977cd2 100644 (file)
@@ -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) &&
index 91107e9dbe950fe050a6e491b26c39afb5753dc8..4bd70ca7551dca36d57f7d9807665232cd810cdf 100755 (executable)
@@ -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"));
index 4170700705fc4b653024caff47d969e08b4246fd..0e09bff289651eae18ad923d6a0d68894aa4fb4c 100644 (file)
@@ -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))
index b050139aa5c102d9444aac3ce4fda9138b5beaa9..ea4191988a81cb5aba724844104416f8bffb18c9 100644 (file)
@@ -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;
 }