]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/adminutil.c
Merge changes from CUPS 1.4svn-r7394.
[thirdparty/cups.git] / cups / adminutil.c
index 449feb9f55eccd1131db8f9e4f421944d81fbc44..70fdce425634dc3c54858f5881b3d8dddf7c9c12 100644 (file)
@@ -4,7 +4,7 @@
  *   Administration utility API definitions for the Common UNIX Printing
  *   System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 2001-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -808,6 +808,9 @@ cupsAdminExportSamba(
   if (have_drivers == 0)
   {
     _cupsSetError(IPP_NOT_FOUND, message);
+
+    unlink(authfile);
+
     return (0);
   }
 
@@ -1057,7 +1060,7 @@ _cupsAdminGetServerSettings(
        in_admin_location = 0;
        in_location       = 0;
       }
-      else if (!strcasecmp(line, "Allow") && in_admin_location &&
+      else if (!strcasecmp(line, "Allow") &&
                strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1")
 #ifdef AF_LOCAL
               && *value != '/'
@@ -1067,9 +1070,9 @@ _cupsAdminGetServerSettings(
 #endif /* AF_INET6 */
               )
       {
-       remote_admin = 1;
-
-       if (!strcasecmp(value, "all"))
+        if (in_admin_location)
+         remote_admin = 1;
+        else if (!strcasecmp(value, "all"))
          remote_any = 1;
       }
       else if (line[0] != '<' && !in_location && !in_policy)
@@ -1613,8 +1616,6 @@ _cupsAdminSetServerSettings(
        if (remote_admin)
          cupsFilePrintf(temp, "  Allow %s\n",
                         remote_any > 0 ? "all" : "@LOCAL");
-       else
-         cupsFilePuts(temp, "  Allow localhost\n");
       }
       else if (in_conf_location && remote_admin >= 0)
       {
@@ -1632,8 +1633,6 @@ _cupsAdminSetServerSettings(
        if (remote_admin)
          cupsFilePrintf(temp, "  Allow %s\n",
                         remote_any > 0 ? "all" : "@LOCAL");
-       else
-         cupsFilePuts(temp, "  Allow localhost\n");
       }
       else if (in_root_location && (remote_admin >= 0 || share_printers >= 0))
       {
@@ -1654,8 +1653,6 @@ _cupsAdminSetServerSettings(
        if (remote_admin > 0 || share_printers > 0)
          cupsFilePrintf(temp, "  Allow %s\n",
                         remote_any > 0 ? "all" : "@LOCAL");
-       else
-         cupsFilePuts(temp, "  Allow localhost\n");
       }
 
       in_admin_location = 0;
@@ -1876,8 +1873,6 @@ _cupsAdminSetServerSettings(
 
     if (remote_admin > 0 || share_printers > 0)
       cupsFilePrintf(temp, "  Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
-    else
-      cupsFilePuts(temp, "  Allow localhost\n");
 
     cupsFilePuts(temp, "</Location>\n");
   }
@@ -1894,8 +1889,6 @@ _cupsAdminSetServerSettings(
 
     if (remote_admin)
       cupsFilePrintf(temp, "  Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
-    else
-      cupsFilePuts(temp, "  Allow localhost\n");
 
     cupsFilePuts(temp, "</Location>\n");
   }
@@ -1915,8 +1908,6 @@ _cupsAdminSetServerSettings(
 
     if (remote_admin)
       cupsFilePrintf(temp, "  Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
-    else
-      cupsFilePuts(temp, "  Allow localhost\n");
 
     cupsFilePuts(temp, "</Location>\n");
   }