Ignore:
Timestamp:
Nov 29, 2012, 1:59:04 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/printing/print_cups.c

    r745 r751  
    3636#endif
    3737
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
    3879static SIG_ATOMIC_T gotalarm;
    3980
     
    172213        bool ret_ok = false;
    173214
    174         for (attr = response->attrs; attr != NULL;) {
     215        for (attr = ; attr != NULL;) {
    175216               /*
    176217                * Skip leading attributes until we hit a printer...
    177218                */
    178219
    179                 while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
    180                         attr = attr->next;
     220                while (attr != NULL && != IPP_TAG_PRINTER)
     221                        attr = ;
    181222
    182223                if (attr == NULL)
     
    190231                info       = NULL;
    191232
    192                 while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) {
     233                while (attr != NULL && == IPP_TAG_PRINTER) {
    193234                        size_t size;
    194                         if (strcmp(attr->name, "printer-name") == 0 &&
    195                             attr->value_tag == IPP_TAG_NAME) {
     235                        if (strcmp(, "printer-name") == 0 &&
     236                            == IPP_TAG_NAME) {
    196237                                if (!pull_utf8_talloc(mem_ctx,
    197238                                                &name,
    198                                                 attr->values[0].string.text,
     239                                                ,
    199240                                                &size)) {
    200241                                        goto err_out;
     
    202243                        }
    203244
    204                         if (strcmp(attr->name, "printer-info") == 0 &&
    205                             attr->value_tag == IPP_TAG_TEXT) {
     245                        if (strcmp(, "printer-info") == 0 &&
     246                            == IPP_TAG_TEXT) {
    206247                                if (!pull_utf8_talloc(mem_ctx,
    207248                                                &info,
    208                                                 attr->values[0].string.text,
     249                                                ,
    209250                                                &size)) {
    210251                                        goto err_out;
     
    212253                        }
    213254
    214                         if (strcmp(attr->name, "printer-location") == 0 &&
    215                             attr->value_tag == IPP_TAG_TEXT) {
     255                        if (strcmp(, "printer-location") == 0 &&
     256                            == IPP_TAG_TEXT) {
    216257                                if (!pull_utf8_talloc(mem_ctx,
    217258                                                &location,
    218                                                 attr->values[0].string.text,
     259                                                ,
    219260                                                &size)) {
    220261                                        goto err_out;
     
    222263                        }
    223264
    224                         attr = attr->next;
     265                        attr = ;
    225266                }
    226267
     
    302343        request = ippNew();
    303344
    304         request->request.op.operation_id = CUPS_GET_PRINTERS;
    305         request->request.op.request_id   = 1;
     345        ;
     346        ;
    306347
    307348        language = cupsLangDefault();
     
    344385        request = ippNew();
    345386
    346         request->request.op.operation_id = CUPS_GET_CLASSES;
    347         request->request.op.request_id   = 1;
     387        ;
     388        ;
    348389
    349390        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
     
    608649        request = ippNew();
    609650
    610         request->request.op.operation_id = IPP_CANCEL_JOB;
    611         request->request.op.request_id   = 1;
     651        ;
     652        ;
    612653
    613654        language = cupsLangDefault();
     
    635676
    636677        if ((response = cupsDoRequest(http, request, "/jobs")) != NULL) {
    637                 if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     678                if ( >= IPP_OK_CONFLICT) {
    638679                        DEBUG(0,("Unable to cancel job %d - %s\n", pjob->sysjob,
    639680                                ippErrorString(cupsLastError())));
     
    705746        request = ippNew();
    706747
    707         request->request.op.operation_id = IPP_HOLD_JOB;
    708         request->request.op.request_id   = 1;
     748        ;
     749        ;
    709750
    710751        language = cupsLangDefault();
     
    731772
    732773        if ((response = cupsDoRequest(http, request, "/jobs")) != NULL) {
    733                 if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     774                if ( >= IPP_OK_CONFLICT) {
    734775                        DEBUG(0,("Unable to hold job %d - %s\n", pjob->sysjob,
    735776                                ippErrorString(cupsLastError())));
     
    801842        request = ippNew();
    802843
    803         request->request.op.operation_id = IPP_RELEASE_JOB;
    804         request->request.op.request_id   = 1;
     844        ;
     845        ;
    805846
    806847        language = cupsLangDefault();
     
    827868
    828869        if ((response = cupsDoRequest(http, request, "/jobs")) != NULL) {
    829                 if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     870                if ( >= IPP_OK_CONFLICT) {
    830871                        DEBUG(0,("Unable to release job %d - %s\n", pjob->sysjob,
    831872                                ippErrorString(cupsLastError())));
     
    857898 */
    858899
    859 static int cups_job_submit(int snum, struct printjob *pjob)
     900static int cups_job_submit(int snum, struct printjob *pjob,
     901                           enum printing_types printing_type,
     902                           char *lpq_cmd)
    860903{
    861904        TALLOC_CTX *frame = talloc_stackframe();
     
    876919        char *filename = NULL;
    877920        size_t size;
    878         uint32_t jobid = (uint32_t)-1;
    879921
    880922        DEBUG(5,("cups_job_submit(%d, %p)\n", snum, pjob));
     
    907949        request = ippNew();
    908950
    909         request->request.op.operation_id = IPP_PRINT_JOB;
    910         request->request.op.request_id   = 1;
     951        ;
     952        ;
    911953
    912954        language = cupsLangDefault();
     
    938980                     pjob->clientmachine);
    939981
    940         /* Get the jobid from the filename. */
    941         jobid = print_parse_jobid(pjob->filename);
    942         if (jobid == (uint32_t)-1) {
    943                 DEBUG(0,("cups_job_submit: failed to parse jobid from name %s\n",
    944                                 pjob->filename ));
    945                 jobid = 0;
    946         }
    947 
    948982        if (!push_utf8_talloc(frame, &jobname, pjob->jobname, &size)) {
    949983                goto out;
     
    951985        new_jobname = talloc_asprintf(frame,
    952986                        "%s%.8u %s", PRINT_SPOOL_PREFIX,
    953                         (unsigned int)jobid,
    954                         jobname);
     987                        pjob->jobid, jobname);
    955988        if (new_jobname == NULL) {
    956989                goto out;
     
    9841017        }
    9851018        if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) {
    986                 if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     1019                if ( >= IPP_OK_CONFLICT) {
    9871020                        DEBUG(0,("Unable to print file to %s - %s\n",
    9881021                                 lp_printername(snum),
     
    9921025                        attr_job_id = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER);
    9931026                        if(attr_job_id) {
    994                                 pjob->sysjob = attr_job_id->values[0].integer;
     1027                                pjob->sysjob = ;
    9951028                                DEBUG(5,("cups_job_submit: job-id %d\n", pjob->sysjob));
    9961029                        } else {
     
    11141147        request = ippNew();
    11151148
    1116         request->request.op.operation_id = IPP_GET_JOBS;
    1117         request->request.op.request_id   = 1;
     1149        ;
     1150        ;
    11181151
    11191152        language = cupsLangDefault();
     
    11431176        }
    11441177
    1145         if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     1178        if ( >= IPP_OK_CONFLICT) {
    11461179                DEBUG(0,("Unable to get jobs for %s - %s\n", uri,
    1147                          ippErrorString(response->request.status.status_code)));
     1180                         ippErrorString()));
    11481181                goto out;
    11491182        }
     
    11571190        queue  = NULL;
    11581191
    1159         for (attr = response->attrs; attr != NULL; attr = attr->next) {
     1192        for (attr = ) {
    11601193               /*
    11611194                * Skip leading attributes until we hit a job...
    11621195                */
    11631196
    1164                 while (attr != NULL && attr->group_tag != IPP_TAG_JOB)
    1165                         attr = attr->next;
     1197                while (attr != NULL && != IPP_TAG_JOB)
     1198;
    11661199
    11671200                if (attr == NULL)
     
    11981231                job_name     = NULL;
    11991232
    1200                 while (attr != NULL && attr->group_tag == IPP_TAG_JOB) {
    1201                         if (attr->name == NULL) {
    1202                                 attr = attr->next;
     1233                while (attr != NULL && == IPP_TAG_JOB) {
     1234 == NULL) {
     1235                                attr = ;
    12031236                                break;
    12041237                        }
    12051238
    1206                         if (strcmp(attr->name, "job-id") == 0 &&
    1207                             attr->value_tag == IPP_TAG_INTEGER)
    1208                                 job_id = attr->values[0].integer;
    1209 
    1210                         if (strcmp(attr->name, "job-k-octets") == 0 &&
    1211                             attr->value_tag == IPP_TAG_INTEGER)
    1212                                 job_k_octets = attr->values[0].integer;
    1213 
    1214                         if (strcmp(attr->name, "job-priority") == 0 &&
    1215                             attr->value_tag == IPP_TAG_INTEGER)
    1216                                 job_priority = attr->values[0].integer;
    1217 
    1218                         if (strcmp(attr->name, "job-state") == 0 &&
    1219                             attr->value_tag == IPP_TAG_ENUM)
    1220                                 job_status = (ipp_jstate_t)(attr->values[0].integer);
    1221 
    1222                         if (strcmp(attr->name, "time-at-creation") == 0 &&
    1223                             attr->value_tag == IPP_TAG_INTEGER)
    1224                                 job_time = attr->values[0].integer;
    1225 
    1226                         if (strcmp(attr->name, "job-name") == 0 &&
    1227                             attr->value_tag == IPP_TAG_NAME) {
     1239, "job-id") == 0 &&
     1240                            == IPP_TAG_INTEGER)
     1241                                job_id = ;
     1242
     1243, "job-k-octets") == 0 &&
     1244                            == IPP_TAG_INTEGER)
     1245                                job_k_octets = ;
     1246
     1247, "job-priority") == 0 &&
     1248                            == IPP_TAG_INTEGER)
     1249                                job_priority = ;
     1250
     1251, "job-state") == 0 &&
     1252                            == IPP_TAG_ENUM)
     1253                                job_status = (ipp_jstate_t));
     1254
     1255, "time-at-creation") == 0 &&
     1256                            == IPP_TAG_INTEGER)
     1257                                job_time = ;
     1258
     1259, "job-name") == 0 &&
     1260                            == IPP_TAG_NAME) {
    12281261                                if (!pull_utf8_talloc(frame,
    12291262                                                &job_name,
    1230                                                 attr->values[0].string.text,
     1263                                                ,
    12311264                                                &size)) {
    12321265                                        goto out;
     
    12341267                        }
    12351268
    1236                         if (strcmp(attr->name, "job-originating-user-name") == 0 &&
    1237                             attr->value_tag == IPP_TAG_NAME) {
     1269, "job-originating-user-name") == 0 &&
     1270                            == IPP_TAG_NAME) {
    12381271                                if (!pull_utf8_talloc(frame,
    12391272                                                &user_name,
    1240                                                 attr->values[0].string.text,
     1273                                                ,
    12411274                                                &size)) {
    12421275                                        goto out;
     
    12441277                        }
    12451278
    1246                         attr = attr->next;
     1279;
    12471280                }
    12481281
     
    12581291                }
    12591292
    1260                 temp->job      = job_id;
     1293                temp->   = job_id;
    12611294                temp->size     = job_k_octets * 1024;
    12621295                temp->status   = job_status == IPP_JOB_PENDING ? LPQ_QUEUED :
     
    12901323        request = ippNew();
    12911324
    1292         request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
    1293         request->request.op.request_id   = 1;
     1325        ;
     1326        ;
    12941327
    12951328        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
     
    13171350        }
    13181351
    1319         if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     1352        if ( >= IPP_OK_CONFLICT) {
    13201353                DEBUG(0,("Unable to get printer status for %s - %s\n", printername,
    1321                          ippErrorString(response->request.status.status_code)));
     1354                         ippErrorString()));
    13221355                goto out;
    13231356        }
     
    13281361
    13291362        if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL) {
    1330                 if (attr->values[0].integer == IPP_PRINTER_STOPPED)
     1363                if ( == IPP_PRINTER_STOPPED)
    13311364                        status->status = LPSTAT_STOPPED;
    13321365                else
     
    13381371                char *msg = NULL;
    13391372                if (!pull_utf8_talloc(frame, &msg,
    1340                                 attr->values[0].string.text,
     1373                                ,
    13411374                                &size)) {
    13421375                        SAFE_FREE(queue);
     
    14141447        request = ippNew();
    14151448
    1416         request->request.op.operation_id = IPP_PAUSE_PRINTER;
    1417         request->request.op.request_id   = 1;
     1449        ;
     1450        ;
    14181451
    14191452        language = cupsLangDefault();
     
    14451478
    14461479        if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) {
    1447                 if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     1480                if ( >= IPP_OK_CONFLICT) {
    14481481                        DEBUG(0,("Unable to pause printer %s - %s\n",
    14491482                                 lp_printername(snum),
     
    15181551        request = ippNew();
    15191552
    1520         request->request.op.operation_id = IPP_RESUME_PRINTER;
    1521         request->request.op.request_id   = 1;
     1553        ;
     1554        ;
    15221555
    15231556        language = cupsLangDefault();
     
    15491582
    15501583        if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) {
    1551                 if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     1584                if ( >= IPP_OK_CONFLICT) {
    15521585                        DEBUG(0,("Unable to resume printer %s - %s\n",
    15531586                                 lp_printername(snum),
Note: See TracChangeset for help on using the changeset viewer.