Changeset 427 for vendor/current/source4/ntptr
- Timestamp:
- Apr 9, 2010, 3:20:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
r414 r427 123 123 * PrintServer PrinterData functions 124 124 */ 125 static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC_CTX *mem_ctx, 126 struct spoolss_GetPrinterData *r) 125 126 static 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) 127 131 { 128 132 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; 132 136 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; 136 140 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; 140 144 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; 144 148 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; 148 152 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; 152 156 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; 156 160 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); 160 165 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); 164 170 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; 168 174 return WERR_OK; 169 } else if (strcmp("OSVersion", r->in.value_name) == 0) {175 } else if (strcmp("OSVersion", value_name) == 0) { 170 176 DATA_BLOB blob; 171 177 enum ndr_err_code ndr_err; … … 182 188 } 183 189 184 * r->out.type = REG_BINARY;185 r-> out.data->binary = blob;190 *type = REG_BINARY; 191 r->binary = blob; 186 192 return WERR_OK; 187 } else if (strcmp("OSVersionEx", r->in.value_name) == 0) {193 } else if (strcmp("OSVersionEx", value_name) == 0) { 188 194 DATA_BLOB blob; 189 195 enum ndr_err_code ndr_err; … … 205 211 } 206 212 207 * r->out.type = REG_BINARY;208 r-> out.data->binary = blob;213 *type = REG_BINARY; 214 r->binary = blob; 209 215 return WERR_OK; 210 } else if (strcmp("DNSMachineName", r->in.value_name) == 0) {216 } else if (strcmp("DNSMachineName", value_name) == 0) { 211 217 if (!lp_realm(server->ntptr->lp_ctx)) return WERR_INVALID_PARAM; 212 218 213 * r->out.type = REG_SZ;214 r-> out.data->string = talloc_asprintf(mem_ctx, "%s.%s",215 216 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); 218 224 return WERR_OK; 219 225 } 220 226 221 227 return WERR_INVALID_PARAM; 228 } 229 230 static 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; 222 256 } 223 257
Note:
See TracChangeset
for help on using the changeset viewer.