]> arthur.barton.de Git - netatalk.git/blobdiff - etc/papd/lp.c
Big configure.in cleanup
[netatalk.git] / etc / papd / lp.c
index 017cee89f6de460e90d9dd1b097611f04bc0de9f..d315b12f7a6cb9fdf9017d43c7edba6018c035e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: lp.c,v 1.29 2009-10-14 01:38:28 didg Exp $
+ * $Id: lp.c,v 1.33 2009-10-29 13:38:15 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -127,7 +127,7 @@ static void convert_octal (char *string, charset_t dest)
     char temp[4];
     long int ch;
 
-    q=p=string;
+    q=p=(unsigned char *)string;
     while ( *p != '\0' ) {
         ch = 0;
         if ( *p == '\\' ) {
@@ -164,7 +164,7 @@ static void translate(charset_t from, charset_t dest, char **option)
     if (*option != NULL) {
         convert_octal(*option, from);
         if (from) {
-             if ((size_t) -1 != (convert_string_allocate(from, dest, *option, strlen(*option), &translated)) ) {
+             if ((size_t) -1 != (convert_string_allocate(from, dest, *option, -1, &translated)) ) {
                  free (*option);
                  *option = translated;
              }
@@ -188,19 +188,19 @@ static void lp_setup_comments (charset_t dest)
 
     if (lp.lp_job) {
 #ifdef DEBUG1
-        LOG(log_debug, logtype_papd, "job: %s", lp.lp_job );
+        LOG(log_debug9, logtype_papd, "job: %s", lp.lp_job );
 #endif
         translate(from, dest, &lp.lp_job);
     }
     if (lp.lp_created_for) {
 #ifdef DEBUG1
-        LOG(log_debug, logtype_papd, "for: %s", lp.lp_created_for );
+        LOG(log_debug9, logtype_papd, "for: %s", lp.lp_created_for );
 #endif
         translate(from, dest, &lp.lp_created_for);
     }
     if (lp.lp_person) {
 #ifdef DEBUG1
-       LOG(log_debug, logtype_papd, "person: %s", lp.lp_person );
+       LOG(log_debug9, logtype_papd, "person: %s", lp.lp_person );
 #endif
        translate(from, dest, &lp.lp_person);
     }
@@ -208,6 +208,8 @@ static void lp_setup_comments (charset_t dest)
 
 #define is_var(a, b) (strncmp((a), (b), 2) == 0)
 
+#if 0
+/* removed, it's not used and a pain to get it right from a security POV */
 static size_t quote(char *dest, char *src, const size_t bsize, size_t len)
 {
 size_t used = 0;
@@ -234,7 +236,6 @@ size_t used = 0;
     return used;
 }
 
-
 static char* pipexlate(char *src)
 {
     char *p, *q, *dest; 
@@ -302,7 +303,7 @@ static char* pipexlate(char *src)
     }
     return destbuf;
 }
-
+#endif
 
 void lp_person(char *person)
 {
@@ -360,7 +361,7 @@ void lp_job(char *job)
 
     lp.lp_job = strdup(job);
 #ifdef DEBUG
-    LOG(log_debug, logtype_papd, "job: %s", lp.lp_job );
+    LOG(log_debug9, logtype_papd, "job: %s", lp.lp_job );
 #endif
     
 }
@@ -545,7 +546,7 @@ int lp_open(struct papfile *out, struct sockaddr_at *sat)
     struct passwd      *pwent;
 
 #ifdef DEBUG
-    LOG (log_debug, logtype_papd, "lp_open");
+    LOG (log_debug9, logtype_papd, "lp_open");
 #endif
 
     if ( lp.lp_flags & LP_JOBPENDING ) {
@@ -631,7 +632,7 @@ int lp_open(struct papfile *out, struct sockaddr_at *sat)
            return( -1 );
        }
 #ifdef DEBUG        
-        LOG(log_debug, logtype_papd, "lp_open: opened %s", name );
+        LOG(log_debug9, logtype_papd, "lp_open: opened %s", name );
 #endif 
     }
     lp.lp_flags |= LP_OPEN;
@@ -684,7 +685,7 @@ int lp_write(struct papfile *in, char *buf, size_t len)
             tbuf = tempbuf2;
             last_line_translated = 1;
 #ifdef DEBUG
-            LOG(log_debug, logtype_papd, "lp_write: %s", tbuf );
+            LOG(log_debug9, logtype_papd, "lp_write: %s", tbuf );
 #endif
         }
         else {
@@ -705,7 +706,7 @@ int lp_write(struct papfile *in, char *buf, size_t len)
      * %%EndComment triggers writing to file */
     if (( lp.lp_flags & LP_OPEN ) == 0 ) {
 #ifdef DEBUG
-        LOG(log_debug, logtype_papd, "lp_write: writing to temporary buffer" );
+        LOG(log_debug9, logtype_papd, "lp_write: writing to temporary buffer" );
 #endif
        if ((bufpos+len) > BUFSIZE) {
             LOG(log_error, logtype_papd, "lp_write: temporary buffer too small" );