diff options
author | Andreas Schneider <asn@samba.org> | 2010-03-31 13:04:30 +0200 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2010-07-27 10:27:07 -0400 |
commit | 2ae1796b090b793397f4082a996b8e430172d365 (patch) | |
tree | 6122f625a9faa6605788206b814c2181e52749b1 | |
parent | 142431d09774da4004ed7fae7f0891f7ba62f8f9 (diff) | |
download | samba-2ae1796b090b793397f4082a996b8e430172d365.tar.gz samba-2ae1796b090b793397f4082a996b8e430172d365.tar.bz2 samba-2ae1796b090b793397f4082a996b8e430172d365.zip |
s3-spoolss: Migrated spoolss_EnumForms to the winreg function.
Signed-off-by: Jim McDonough <jmcd@samba.org>
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 85 |
1 files changed, 8 insertions, 77 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index ff315dae70..fa712cd12e 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -6596,58 +6596,6 @@ static WERROR fill_form_info_1(TALLOC_CTX *mem_ctx, } /**************************************************************** - spoolss_enumforms_level1 -****************************************************************/ - -static WERROR spoolss_enumforms_level1(TALLOC_CTX *mem_ctx, - const nt_forms_struct *builtin_forms, - uint32_t num_builtin_forms, - const nt_forms_struct *user_forms, - uint32_t num_user_forms, - union spoolss_FormInfo **info_p, - uint32_t *count) -{ - union spoolss_FormInfo *info; - WERROR result = WERR_OK; - int i; - - *count = num_builtin_forms + num_user_forms; - - info = TALLOC_ARRAY(mem_ctx, union spoolss_FormInfo, *count); - W_ERROR_HAVE_NO_MEMORY(info); - - /* construct the list of form structures */ - for (i=0; i<num_builtin_forms; i++) { - DEBUGADD(6,("Filling builtin form number [%d]\n",i)); - result = fill_form_info_1(info, &info[i].info1, - &builtin_forms[i]); - if (!W_ERROR_IS_OK(result)) { - goto out; - } - } - - for (i=0; i<num_user_forms; i++) { - DEBUGADD(6,("Filling user form number [%d]\n",i)); - result = fill_form_info_1(info, &info[i+num_builtin_forms].info1, - &user_forms[i]); - if (!W_ERROR_IS_OK(result)) { - goto out; - } - } - - out: - if (!W_ERROR_IS_OK(result)) { - TALLOC_FREE(info); - *count = 0; - return result; - } - - *info_p = info; - - return WERR_OK; -} - -/**************************************************************** _spoolss_EnumForms ****************************************************************/ @@ -6655,10 +6603,6 @@ WERROR _spoolss_EnumForms(pipes_struct *p, struct spoolss_EnumForms *r) { WERROR result; - nt_forms_struct *user_forms = NULL; - nt_forms_struct *builtin_forms = NULL; - uint32_t num_user_forms; - uint32_t num_builtin_forms; *r->out.count = 0; *r->out.needed = 0; @@ -6674,39 +6618,26 @@ WERROR _spoolss_EnumForms(pipes_struct *p, DEBUGADD(5,("Offered buffer size [%d]\n", r->in.offered)); DEBUGADD(5,("Info level [%d]\n", r->in.level)); - num_builtin_forms = get_builtin_ntforms(&builtin_forms); - DEBUGADD(5,("Number of builtin forms [%d]\n", num_builtin_forms)); - num_user_forms = get_ntforms(&user_forms); - DEBUGADD(5,("Number of user forms [%d]\n", num_user_forms)); - - if (num_user_forms + num_builtin_forms == 0) { - SAFE_FREE(builtin_forms); - SAFE_FREE(user_forms); - return WERR_NO_MORE_ITEMS; - } - switch (r->in.level) { case 1: - result = spoolss_enumforms_level1(p->mem_ctx, - builtin_forms, - num_builtin_forms, - user_forms, - num_user_forms, - r->out.info, - r->out.count); + result = winreg_printer_enumforms1(p->mem_ctx, + p->server_info, + r->out.count, + r->out.info); break; default: result = WERR_UNKNOWN_LEVEL; break; } - SAFE_FREE(user_forms); - SAFE_FREE(builtin_forms); - if (!W_ERROR_IS_OK(result)) { return result; } + if (*r->out.count == 0) { + return WERR_NO_MORE_ITEMS; + } + *r->out.needed = SPOOLSS_BUFFER_UNION_ARRAY(p->mem_ctx, spoolss_EnumForms, *r->out.info, r->in.level, |