Ignore:
Timestamp:
Apr 9, 2010, 3:20:58 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.5.x: update to 3.5.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/ntptr/simple_ldb/ntptr_simple_ldb.c

    r414 r427  
    123123 * PrintServer PrinterData functions
    124124 */
    125 static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
    126                                       struct spoolss_GetPrinterData *r)
     125
     126static WERROR sptr_PrintServerData(struct ntptr_GenericHandle *server,
     127                                   TALLOC_CTX *mem_ctx,
     128                                   const char *value_name,
     129                                   union spoolss_PrinterData *r,
     130                                   enum winreg_Type *type)
    127131{
    128132        struct dcerpc_server_info *server_info = lp_dcerpc_server_info(mem_ctx, server->ntptr->lp_ctx);
    129         if (strcmp("W3SvcInstalled", r->in.value_name) == 0) {
    130                 *r->out.type            = REG_DWORD;
    131                 r->out.data->value      = 0;
     133        if (strcmp("W3SvcInstalled", value_name) == 0) {
     134                *type           = REG_DWORD;
     135                r->value        = 0;
    132136                return WERR_OK;
    133         } else if (strcmp("BeepEnabled", r->in.value_name) == 0) {
    134                 *r->out.type            = REG_DWORD;
    135                 r->out.data->value      = 0;
     137        } else if (strcmp("BeepEnabled", value_name) == 0) {
     138                *type           = REG_DWORD;
     139                r->value        = 0;
    136140                return WERR_OK;
    137         } else if (strcmp("EventLog", r->in.value_name) == 0) {
    138                 *r->out.type            = REG_DWORD;
    139                 r->out.data->value      = 0;
     141        } else if (strcmp("EventLog", value_name) == 0) {
     142                *type           = REG_DWORD;
     143                r->value        = 0;
    140144                return WERR_OK;
    141         } else if (strcmp("NetPopup", r->in.value_name) == 0) {
    142                 *r->out.type            = REG_DWORD;
    143                 r->out.data->value      = 0;
     145        } else if (strcmp("NetPopup", value_name) == 0) {
     146                *type           = REG_DWORD;
     147                r->value        = 0;
    144148                return WERR_OK;
    145         } else if (strcmp("NetPopupToComputer", r->in.value_name) == 0) {
    146                 *r->out.type            = REG_DWORD;
    147                 r->out.data->value      = 0;
     149        } else if (strcmp("NetPopupToComputer", value_name) == 0) {
     150                *type           = REG_DWORD;
     151                r->value        = 0;
    148152                return  WERR_OK;
    149         } else if (strcmp("MajorVersion", r->in.value_name) == 0) {
    150                 *r->out.type            = REG_DWORD;
    151                 r->out.data->value      = 3;
     153        } else if (strcmp("MajorVersion", value_name) == 0) {
     154                *type           = REG_DWORD;
     155                r->value        = 3;
    152156                return WERR_OK;
    153         } else if (strcmp("MinorVersion", r->in.value_name) == 0) {
    154                 *r->out.type            = REG_DWORD;
    155                 r->out.data->value      = 0;
     157        } else if (strcmp("MinorVersion", value_name) == 0) {
     158                *type           = REG_DWORD;
     159                r->value        = 0;
    156160                return WERR_OK;
    157         } else if (strcmp("DefaultSpoolDirectory", r->in.value_name) == 0) {
    158                 *r->out.type            = REG_SZ;
    159                 r->out.data->string     = "C:\\PRINTERS";
     161        } else if (strcmp("DefaultSpoolDirectory", value_name) == 0) {
     162                *type           = REG_SZ;
     163                r->string       = talloc_strdup(mem_ctx, "C:\\PRINTERS");
     164                W_ERROR_HAVE_NO_MEMORY(r->string);
    160165                return  WERR_OK;
    161         } else if (strcmp("Architecture", r->in.value_name) == 0) {
    162                 *r->out.type            = REG_SZ;
    163                 r->out.data->string     = SPOOLSS_ARCHITECTURE_NT_X86;
     166        } else if (strcmp("Architecture", value_name) == 0) {
     167                *type           = REG_SZ;
     168                r->string       = talloc_strdup(mem_ctx, SPOOLSS_ARCHITECTURE_NT_X86);
     169                W_ERROR_HAVE_NO_MEMORY(r->string);
    164170                return  WERR_OK;
    165         } else if (strcmp("DsPresent", r->in.value_name) == 0) {
    166                 *r->out.type            = REG_DWORD;
    167                 r->out.data->value      = 1;
     171        } else if (strcmp("DsPresent", value_name) == 0) {
     172                *type           = REG_DWORD;
     173                r->value        = 1;
    168174                return WERR_OK;
    169         } else if (strcmp("OSVersion", r->in.value_name) == 0) {
     175        } else if (strcmp("OSVersion", value_name) == 0) {
    170176                DATA_BLOB blob;
    171177                enum ndr_err_code ndr_err;
     
    182188                }
    183189
    184                 *r->out.type            = REG_BINARY;
    185                 r->out.data->binary     = blob;
     190                *type           = REG_BINARY;
     191                r->binary       = blob;
    186192                return WERR_OK;
    187         } else if (strcmp("OSVersionEx", r->in.value_name) == 0) {
     193        } else if (strcmp("OSVersionEx", value_name) == 0) {
    188194                DATA_BLOB blob;
    189195                enum ndr_err_code ndr_err;
     
    205211                }
    206212
    207                 *r->out.type            = REG_BINARY;
    208                 r->out.data->binary     = blob;
     213                *type           = REG_BINARY;
     214                r->binary       = blob;
    209215                return WERR_OK;
    210         } else if (strcmp("DNSMachineName", r->in.value_name) == 0) {
     216        } else if (strcmp("DNSMachineName", value_name) == 0) {
    211217                if (!lp_realm(server->ntptr->lp_ctx)) return WERR_INVALID_PARAM;
    212218
    213                 *r->out.type            = REG_SZ;
    214                 r->out.data->string     = talloc_asprintf(mem_ctx, "%s.%s",
    215                                                                    lp_netbios_name(server->ntptr->lp_ctx),
    216                                                                    lp_realm(server->ntptr->lp_ctx));
    217                 W_ERROR_HAVE_NO_MEMORY(r->out.data->string);
     219                *type           = REG_SZ;
     220                r->string       = talloc_asprintf(mem_ctx, "%s.%s",
     221                                                   lp_netbios_name(server->ntptr->lp_ctx),
     222                                                   lp_realm(server->ntptr->lp_ctx));
     223                W_ERROR_HAVE_NO_MEMORY(r->string);
    218224                return WERR_OK;
    219225        }
    220226
    221227        return WERR_INVALID_PARAM;
     228}
     229
     230static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx,
     231                                      struct spoolss_GetPrinterData *r)
     232{
     233        WERROR result;
     234        union spoolss_PrinterData data;
     235        DATA_BLOB blob;
     236        enum ndr_err_code ndr_err;
     237
     238        result = sptr_PrintServerData(server, mem_ctx, r->in.value_name, &data, r->out.type);
     239        if (!W_ERROR_IS_OK(result)) {
     240                return result;
     241        }
     242
     243        ndr_err = ndr_push_union_blob(&blob, mem_ctx, lp_iconv_convenience(server->ntptr->lp_ctx),
     244                                      &data, *r->out.type, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData);
     245        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     246                return WERR_GENERAL_FAILURE;
     247        }
     248
     249        *r->out.needed = blob.length;
     250
     251        if (r->in.offered >= *r->out.needed) {
     252                memcpy(r->out.data, blob.data, blob.length);
     253        }
     254
     255        return WERR_OK;
    222256}
    223257
Note: See TracChangeset for help on using the changeset viewer.