WERROR winreg_create_printer(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info *server_info,
+ const char *servername,
const char *sharename)
{
uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info *server_info,
+ const char *servername,
const char *printer,
struct spoolss_PrinterInfo2 **pinfo2)
{
goto done;
}
- info2->servername = talloc_asprintf(info2, "\\\\%s", global_myname());
- if (info2->servername == NULL) {
- result = WERR_NOMEM;
- goto done;
- }
-
+ info2->servername = EMPTY_STRING;
info2->printername = EMPTY_STRING;
info2->sharename = EMPTY_STRING;
info2->portname = EMPTY_STRING;
info2->datatype = EMPTY_STRING;
info2->parameters = EMPTY_STRING;
+ if (servername != NULL && servername[0] != '\0') {
+ info2->servername = talloc_asprintf(info2, "\\\\%s", servername);
+ if (info2->servername == NULL) {
+ result = WERR_NOMEM;
+ goto done;
+ }
+ }
+
for (i = 0; i < num_values; i++) {
v = &enum_values[i];
v,
"Name",
&info2->printername);
+ if (W_ERROR_IS_OK(result) && info2->servername[0] != '\0') {
+ char *p = talloc_asprintf(info2, "%s\\%s",
+ info2->servername,
+ info2->printername);
+ if (p == NULL) {
+ result = WERR_NOMEM;
+ }
+ info2->printername = p;
+ }
CHECK_ERROR(result);
result = winreg_enumval_to_sz(info2,
WERROR winreg_create_printer(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info *server_info,
+ const char *servername,
const char *sharename);
/**
*
* @param[in] server_info The server supplied session info.
*
+ * @param[in] printer The servername to use.
+ *
* @param[in] printer The name of the printer to get.
*
* @param[out] pinfo2 A pointer to store a PRINTER_INFO_2 structure.
*/
WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info *server_info,
+ const char *servername,
const char *printer,
struct spoolss_PrinterInfo2 **pinfo2);