if (is_printer_published(tmp_ctx, session_info, msg_ctx,
servername, printer, &pinfo2)) {
struct GUID guid;
- struct GUID_txt_buf guid_txt;
+ char *guidstr;
werr = nt_printer_guid_get(tmp_ctx, session_info, msg_ctx,
printer, &guid);
if (!W_ERROR_IS_OK(werr)) {
printer));
}
}
- r->guid = talloc_strdup_upper(mem_ctx,
- GUID_buf_string(&guid, &guid_txt));
+
+ /* [MS-RPRN] section 2.2: must use curly-braced GUIDs */
+ guidstr = GUID_string2(mem_ctx, &guid);
+ if (guidstr == NULL) {
+ werr = WERR_NOT_ENOUGH_MEMORY;
+ goto out_tmp_free;
+ }
+ /* Convert GUID string to uppercase otherwise printers
+ * are pruned */
+ r->guid = talloc_strdup_upper(mem_ctx, guidstr);
r->action = DSPRINT_PUBLISH;
+
+ TALLOC_FREE(guidstr);
} else {
r->guid = talloc_strdup(mem_ctx, "");
r->action = DSPRINT_UNPUBLISH;