[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#394255: libcupsys2: ppd API fails to discover printer nickname and options



Package: libcupsys2
Version: 1.2.4-2+b1
Severity: important

Hello,

I have discovered a problem in the ppd cups API. The new API of cups ppd does
not correctly detect nickname and options of the printer.

I have tested on many ppds like
http://www.linuxprinting.org/foomatic-db/db/source/PPD/HP/mono_laser/hp_LaserJet_2300.ppd. And it does not work.

I have tried to patch it but I have failed.
For the nickname, the problem is due to the function ppdOpen2(). This function
does not check the return code of the function cupsCharsetToUTF8(). In this case,
this function returns -1.

I joined a program that reproduces the bug. Called with the previous ppd, the
program must print "HP LaserJet 2300 Postscript (recommended)" and he prints
nothing. This code worked perfectly with the version 1.1.23-12.


Thanks.


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-386
Locale: LANG=fr_FR@euro, LC_CTYPE=fr_FR@euro (charmap=ISO-8859-15)

Versions of packages libcupsys2 depends on:
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries
ii  libgnutls13                  1.4.4-1     the GNU TLS library - runtime libr
ii  zlib1g                       1:1.2.3-13  compression library - runtime

libcupsys2 recommends no packages.

-- no debconf information
/* gcc -Wall test-cups.c -o test-cups -lcups */
#include <cups/ppd.h>
#include <cups/cups.h>

int main(int argc,char** argv){
    ppd_file_t *ppd;

    if(argc<2){
        fprintf(stderr, "Usage: %s nom.ppd \n",argv[0]);
        return 1;
    }
    if( (ppd = ppdOpenFile(argv[1])) == NULL){
        printf("Failed to open: %s \n",argv[1]);
        return 2;
    }
    printf("nickname: %s\n", ppd->nickname);
    ppdClose(ppd);
    return 0;
}



Reply to: