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_iprint.c

    r745 r751  
    3535#define NOVELL_SERVER_VERSION_OES_SP1           33554432
    3636
     37
     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
     79
    3780/*
    3881 * 'iprint_passwd_cb()' - The iPrint password callback...
     
    93136        request = ippNew();
    94137
    95         request->request.op.operation_id = (ipp_op_t)OPERATION_NOVELL_MGMT;
    96         request->request.op.request_id   = 1;
     138        ;
     139        ;
    97140
    98141        language = cupsLangDefault();
     
    115158
    116159        if (((response = cupsDoRequest(http, request, "/ipp/")) == NULL) ||
    117             (response->request.status.status_code >= IPP_OK_CONFLICT))
     160            ( >= IPP_OK_CONFLICT))
    118161                goto out;
    119162
    120163        if (((attr = ippFindAttribute(response, "server-version",
    121164                                      IPP_TAG_STRING)) != NULL)) {
    122                 if ((ver = strstr(attr->values[0].string.text,
     165                if ((ver = strstr(,
    123166                                  NOVELL_SERVER_VERSION_STRING)) != NULL) {
    124167                        ver += strlen(NOVELL_SERVER_VERSION_STRING);
     
    136179                }
    137180
    138                 if ((os = strstr(attr->values[0].string.text,
     181                if ((os = strstr(,
    139182                                  NOVELL_SERVER_SYSNAME)) != NULL) {
    140183                        os += strlen(NOVELL_SERVER_SYSNAME);
     
    185228        request = ippNew();
    186229
    187         request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
    188         request->request.op.request_id   = reqId;
     230        ;
     231        ;
    189232
    190233        language = cupsLangDefault();
     
    231274        }
    232275
    233         for (attr = response->attrs; attr != NULL;) {
     276        for (attr = ; attr != NULL;) {
    234277               /*
    235278                * Skip leading attributes until we hit a printer...
    236279                */
    237280
    238                 while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
    239                         attr = attr->next;
     281                while (attr != NULL && != IPP_TAG_PRINTER)
     282                        attr = ;
    240283
    241284                if (attr == NULL)
     
    251294                secure     = 0;
    252295
    253                 while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) {
    254                         if (strcmp(attr->name, "printer-name") == 0 &&
    255                             attr->value_tag == IPP_TAG_NAME)
    256                                 name = attr->values[0].string.text;
    257 
    258                         if (strcmp(attr->name, "printer-info") == 0 &&
    259                             (attr->value_tag == IPP_TAG_TEXT ||
    260                             attr->value_tag == IPP_TAG_TEXTLANG))
    261                                 info = attr->values[0].string.text;
     296                while (attr != NULL && == IPP_TAG_PRINTER) {
     297                        if (strcmp(, "printer-name") == 0 &&
     298                            == IPP_TAG_NAME)
     299                                name = ;
     300
     301                        if (strcmp(, "printer-info") == 0 &&
     302                            ( == IPP_TAG_TEXT ||
     303                            == IPP_TAG_TEXTLANG))
     304                                info = ;
    262305
    263306                       /*
     
    267310                        * printer should show up
    268311                        */
    269                         if (!strcmp(attr->name, "smb-enabled") &&
    270                             ((attr->value_tag == IPP_TAG_INTEGER &&
    271                             !attr->values[0].integer) ||
    272                             (attr->value_tag == IPP_TAG_BOOLEAN &&
    273                             !attr->values[0].boolean)))
     312                        if (!strcmp(, "smb-enabled") &&
     313                            (( == IPP_TAG_INTEGER &&
     314                            !) ||
     315                            ( == IPP_TAG_BOOLEAN &&
     316                            !)))
    274317                                smb_enabled = 0;
    275318
     
    280323                        * printer should show up
    281324                        */
    282                         if (!strcmp(attr->name, "security-enabled") &&
    283                             ((attr->value_tag == IPP_TAG_INTEGER &&
    284                             attr->values[0].integer) ||
    285                             (attr->value_tag == IPP_TAG_BOOLEAN &&
    286                             attr->values[0].boolean)))
     325                        if (!strcmp(, "security-enabled") &&
     326                            (( == IPP_TAG_INTEGER &&
     327                            ) ||
     328                            ( == IPP_TAG_BOOLEAN &&
     329                            )))
    287330                                secure = 1;
    288331
    289                         attr = attr->next;
     332                        attr = ;
    290333                }
    291334
     
    344387        request = ippNew();
    345388
    346         request->request.op.operation_id =
    347                 (ipp_op_t)OPERATION_NOVELL_LIST_PRINTERS;
    348         request->request.op.request_id   = 1;
     389        ippSetOperation(request, (ipp_op_t)OPERATION_NOVELL_LIST_PRINTERS);
     390        ippSetRequestId(request, 1);
    349391
    350392        language = cupsLangDefault();
     
    369411        }
    370412
    371         for (attr = response->attrs; attr != NULL;) {
     413        for (attr = ; attr != NULL;) {
    372414               /*
    373415                * Skip leading attributes until we hit a printer...
    374416                */
    375417
    376                 while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
    377                         attr = attr->next;
     418                while (attr != NULL && != IPP_TAG_PRINTER)
     419                        attr = ;
    378420
    379421                if (attr == NULL)
     
    384426                */
    385427
    386                 while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
     428                while (attr != NULL && == IPP_TAG_PRINTER)
    387429                {
    388                         if (strcmp(attr->name, "printer-name") == 0 &&
    389                             (attr->value_tag == IPP_TAG_URI ||
    390                              attr->value_tag == IPP_TAG_NAME ||
    391                              attr->value_tag == IPP_TAG_TEXT ||
    392                              attr->value_tag == IPP_TAG_NAMELANG ||
    393                              attr->value_tag == IPP_TAG_TEXTLANG))
     430                        if (strcmp(, "printer-name") == 0 &&
     431                            ( == IPP_TAG_URI ||
     432                              == IPP_TAG_NAME ||
     433                              == IPP_TAG_TEXT ||
     434                              == IPP_TAG_NAMELANG ||
     435                              == IPP_TAG_TEXTLANG))
    394436                        {
    395                                 for (i = 0; i<attr->num_values; i++)
     437                                for (i = 0; i<; i++)
    396438                                {
    397                                         char *url = attr->values[i].string.text;
     439                                        char *url = ;
    398440                                        if (!url || !strlen(url))
    399441                                                continue;
     
    401443                                }
    402444                        }
    403                         attr = attr->next;
     445                        attr = ;
    404446                }
    405447        }
     
    467509        request = ippNew();
    468510
    469         request->request.op.operation_id = IPP_CANCEL_JOB;
    470         request->request.op.request_id   = 1;
     511        ;
     512        ;
    471513
    472514        language = cupsLangDefault();
     
    494536
    495537        if ((response = cupsDoRequest(http, request, httpPath)) != NULL) {
    496                 if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     538                if ( >= IPP_OK_CONFLICT) {
    497539                        DEBUG(0,("Unable to cancel job %d - %s\n", pjob->sysjob,
    498540                                ippErrorString(cupsLastError())));
     
    565607        request = ippNew();
    566608
    567         request->request.op.operation_id = IPP_HOLD_JOB;
    568         request->request.op.request_id   = 1;
     609        ;
     610        ;
    569611
    570612        language = cupsLangDefault();
     
    594636
    595637        if ((response = cupsDoRequest(http, request, httpPath)) != NULL) {
    596                 if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     638                if ( >= IPP_OK_CONFLICT) {
    597639                        DEBUG(0,("Unable to hold job %d - %s\n", pjob->sysjob,
    598640                                ippErrorString(cupsLastError())));
     
    665707        request = ippNew();
    666708
    667         request->request.op.operation_id = IPP_RELEASE_JOB;
    668         request->request.op.request_id   = 1;
     709        ;
     710        ;
    669711
    670712        language = cupsLangDefault();
     
    694736
    695737        if ((response = cupsDoRequest(http, request, httpPath)) != NULL) {
    696                 if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     738                if ( >= IPP_OK_CONFLICT) {
    697739                        DEBUG(0,("Unable to release job %d - %s\n", pjob->sysjob,
    698740                                ippErrorString(cupsLastError())));
     
    723765 */
    724766
    725 static int iprint_job_submit(int snum, struct printjob *pjob)
     767static int iprint_job_submit(int snum, struct printjob *pjob,
     768                             enum printing_types printing_type,
     769                             char *lpq_cmd)
    726770{
    727771        int             ret = 1;                /* Return value */
     
    764808        request = ippNew();
    765809
    766         request->request.op.operation_id = IPP_PRINT_JOB;
    767         request->request.op.request_id   = 1;
     810        ;
     811        ;
    768812
    769813        language = cupsLangDefault();
     
    798842
    799843        if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) {
    800                 if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     844                if ( >= IPP_OK_CONFLICT) {
    801845                        DEBUG(0,("Unable to print file to %s - %s\n",
    802846                                 lp_printername(snum),
     
    818862
    819863                attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER);
    820                 if (attr != NULL && attr->group_tag == IPP_TAG_JOB)
     864                if (attr != NULL && == IPP_TAG_JOB)
    821865                {
    822                         pjob->sysjob = attr->values[0].integer;
     866                        pjob->sysjob = ;
    823867                }
    824868        }
     
    867911        int             job_k_octets;   /* job-k-octets attribute */
    868912        time_t          job_time;       /* time-at-creation attribute */
    869         time_t          printer_current_time = 0;       /* printer's current time */
    870913        time_t          printer_up_time = 0;    /* printer's uptime */
    871914        ipp_jstate_t    job_status;     /* job-status attribute */
     
    940983        request = ippNew();
    941984
    942         request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
    943         request->request.op.request_id   = 2;
     985        ;
     986        ;
    944987
    945988        language = cupsLangDefault();
     
    9721015        }
    9731016
    974         if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     1017        if ( >= IPP_OK_CONFLICT) {
    9751018                DEBUG(0,("Unable to get printer status for %s - %s\n", printername,
    976                          ippErrorString(response->request.status.status_code)));
     1019                         ippErrorString()));
    9771020                *q = queue;
    9781021                goto out;
     
    9841027
    9851028        if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL) {
    986                 if (attr->values[0].integer == IPP_PRINTER_STOPPED)
     1029                if ( == IPP_PRINTER_STOPPED)
    9871030                        status->status = LPSTAT_STOPPED;
    9881031                else
     
    9921035        if ((attr = ippFindAttribute(response, "printer-state-message",
    9931036                                     IPP_TAG_TEXT)) != NULL)
    994                 fstrcpy(status->message, attr->values[0].string.text);
    995 
    996         if ((attr = ippFindAttribute(response, "printer-current-time",
    997                                      IPP_TAG_DATE)) != NULL)
    998                 printer_current_time = ippDateToTime(attr->values[0].date);
     1037                fstrcpy(status->message, ippGetString(attr, 0, NULL));
    9991038
    10001039        if ((attr = ippFindAttribute(response, "printer-up-time",
    10011040                                     IPP_TAG_INTEGER)) != NULL)
    1002                 printer_up_time = attr->values[0].integer;
     1041                printer_up_time = ;
    10031042
    10041043        ippDelete(response);
     
    10171056        request = ippNew();
    10181057
    1019         request->request.op.operation_id = IPP_GET_JOBS;
    1020         request->request.op.request_id   = 3;
     1058        ;
     1059        ;
    10211060
    10221061        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
     
    10461085        }
    10471086
    1048         if (response->request.status.status_code >= IPP_OK_CONFLICT) {
     1087        if ( >= IPP_OK_CONFLICT) {
    10491088                DEBUG(0,("Unable to get jobs for %s - %s\n", uri,
    1050                          ippErrorString(response->request.status.status_code)));
     1089                         ippErrorString()));
    10511090                goto out;
    10521091        }
     
    10601099        queue  = NULL;
    10611100
    1062         for (attr = response->attrs; attr != NULL; attr = attr->next) {
     1101        for (attr = ) {
    10631102               /*
    10641103                * Skip leading attributes until we hit a job...
    10651104                */
    10661105
    1067                 while (attr != NULL && attr->group_tag != IPP_TAG_JOB)
    1068                         attr = attr->next;
     1106                while (attr != NULL && != IPP_TAG_JOB)
     1107                        attr = ;
    10691108
    10701109                if (attr == NULL)
     
    11011140                job_name     = NULL;
    11021141
    1103                 while (attr != NULL && attr->group_tag == IPP_TAG_JOB) {
    1104                         if (attr->name == NULL) {
    1105                                 attr = attr->next;
     1142                while (attr != NULL && == IPP_TAG_JOB) {
     1143                        if ( == NULL) {
     1144                                attr = ;
    11061145                                break;
    11071146                        }
    11081147
    1109                         if (strcmp(attr->name, "job-id") == 0 &&
    1110                             attr->value_tag == IPP_TAG_INTEGER)
    1111                                 job_id = attr->values[0].integer;
    1112 
    1113                         if (strcmp(attr->name, "job-k-octets") == 0 &&
    1114                             attr->value_tag == IPP_TAG_INTEGER)
    1115                                 job_k_octets = attr->values[0].integer;
    1116 
    1117                         if (strcmp(attr->name, "job-priority") == 0 &&
    1118                             attr->value_tag == IPP_TAG_INTEGER)
    1119                                 job_priority = attr->values[0].integer;
    1120 
    1121                         if (strcmp(attr->name, "job-state") == 0 &&
    1122                             attr->value_tag == IPP_TAG_ENUM)
    1123                                 job_status = (ipp_jstate_t)(attr->values[0].integer);
    1124 
    1125                         if (strcmp(attr->name, "time-at-creation") == 0 &&
    1126                             attr->value_tag == IPP_TAG_INTEGER)
     1148                        if (strcmp(, "job-id") == 0 &&
     1149                            == IPP_TAG_INTEGER)
     1150                                job_id = ;
     1151
     1152                        if (strcmp(, "job-k-octets") == 0 &&
     1153                            == IPP_TAG_INTEGER)
     1154                                job_k_octets = ;
     1155
     1156                        if (strcmp(, "job-priority") == 0 &&
     1157                            == IPP_TAG_INTEGER)
     1158                                job_priority = ;
     1159
     1160                        if (strcmp(, "job-state") == 0 &&
     1161                            == IPP_TAG_ENUM)
     1162                                job_status = (ipp_jstate_t));
     1163
     1164                        if (strcmp(, "time-at-creation") == 0 &&
     1165                            == IPP_TAG_INTEGER)
    11271166                        {
    11281167                               /*
     
    11341173
    11351174                                if (jobUseUnixTime)
    1136                                         job_time = attr->values[0].integer;
     1175                                        job_time =
    11371176                                else
    1138                                         job_time = time(NULL) - printer_up_time + attr->values[0].integer;
     1177                                        job_time = time(NULL) - printer_up_time + ;
    11391178                        }
    11401179
    1141                         if (strcmp(attr->name, "job-name") == 0 &&
    1142                             (attr->value_tag == IPP_TAG_NAMELANG ||
    1143                              attr->value_tag == IPP_TAG_NAME))
    1144                                 job_name = attr->values[0].string.text;
    1145 
    1146                         if (strcmp(attr->name, "job-originating-user-name") == 0 &&
    1147                             (attr->value_tag == IPP_TAG_NAMELANG ||
    1148                              attr->value_tag == IPP_TAG_NAME))
    1149                                 user_name = attr->values[0].string.text;
    1150 
    1151                         attr = attr->next;
     1180                        if (strcmp(, "job-name") == 0 &&
     1181                            ( == IPP_TAG_NAMELANG ||
     1182                              == IPP_TAG_NAME))
     1183                                job_name = ;
     1184
     1185                        if (strcmp(, "job-originating-user-name") == 0 &&
     1186                            ( == IPP_TAG_NAMELANG ||
     1187                              == IPP_TAG_NAME))
     1188                                user_name = ;
     1189
     1190                        attr = ;
    11521191                }
    11531192
     
    11631202                }
    11641203
    1165                 temp->job      = job_id;
     1204                temp->   = job_id;
    11661205                temp->size     = job_k_octets * 1024;
    11671206                temp->status   = job_status == IPP_JOB_PENDING ? LPQ_QUEUED :
Note: See TracChangeset for help on using the changeset viewer.