Skip to content

Instantly share code, notes, and snippets.

@citrus-it

citrus-it/smb.md Secret

Last active Apr 24, 2021
Embed
What would you like to do?
--- a/usr/src/cmd/smbsrv/smbd/smbd_spool.c
+++ b/usr/src/cmd/smbsrv/smbd/smbd_spool.c
@@ -198,7 +198,6 @@ smbd_spool_copyfile(smb_inaddr_t *ipaddr, char *username, char *path,
        http_t          *http = NULL;           /* HTTP connection to server */
        ipp_t           *request = NULL;        /* IPP Request */
        ipp_t           *response = NULL;       /* IPP Response */
-       cups_lang_t     *language = NULL;       /* Default language */
        char            uri[HTTP_MAX_URI];      /* printer-uri attribute */
        char            new_jobname[SMBD_PJOBLEN];
        smbd_printjob_t pjob;
@@ -233,22 +232,12 @@ smbd_spool_copyfile(smb_inaddr_t *ipaddr, char *username, char *path,
                return;
        }

-       if ((request = cups->ippNew()) == NULL) {
+       if ((request = cups->ippNewRequest(IPP_PRINT_JOB)) == NULL) {
                syslog(LOG_INFO,
                    "smbd_spool_copyfile: ipp not running");
                return;
        }

-       request->request.op.operation_id = IPP_PRINT_JOB;
-       request->request.op.request_id = 1;
-       language = cups->cupsLangDefault();
-
-       cups->ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
-           "attributes-charset", NULL, cups->cupsLangEncoding(language));
-
-       cups->ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
-           "attributes-natural-language", NULL, language->language);
-
        (void) snprintf(uri, sizeof (uri), "ipp://localhost/printers/%s",
            SMBD_PRINTER);
        pjob.pj_pid = pthread_self();
@@ -291,7 +280,8 @@ smbd_spool_copyfile(smb_inaddr_t *ipaddr, char *username, char *path,
        response = cups->cupsDoFileRequest(http, request, uri,
            pjob.pj_filename);
        if (response != NULL) {
-               if (response->request.status.status_code >= IPP_OK_CONFLICT) {
+               ipp_status_t status = cups->ippGetStatusCode(response);
+               if (status >= IPP_OK_CONFLICT) {
                        syslog(LOG_ERR,
                            "smbd_spool_copyfile: printer %s: %s",
                            SMBD_PRINTER,
@@ -313,9 +303,6 @@ smbd_spool_copyfile(smb_inaddr_t *ipaddr, char *username, char *path,
        if (response)
                cups->ippDelete(response);

-       if (language)
-               cups->cupsLangFree(language);
-
        if (http)
                cups->httpClose(http);
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment