]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/usersys.c
Import CUPS 1.4svn-r7356.
[thirdparty/cups.git] / cups / usersys.c
index 7c9a8a848982fd2e0f902ff5bc18bf04ff6a11f6..28b40d0be537dff00a28345ac4f5a02c6173d77d 100644 (file)
@@ -1,26 +1,17 @@
 /*
- * "$Id: usersys.c 5902 2006-08-29 15:51:19Z mike $"
+ * "$Id: usersys.c 6649 2007-07-11 21:46:42Z mike $"
  *
  *   User, system, and password routines for the Common UNIX Printing
  *   System (CUPS).
  *
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  *   This file is subject to the Apple OS-Developed Software exception.
  *
@@ -63,9 +54,9 @@ static cups_file_t    *cups_open_client_conf(void);
  * 'cupsEncryption()' - Get the default encryption settings.
  *
  * The default encryption setting comes from the CUPS_ENCRYPTION
- * environment variable, then the ~/.cupsrc file, and finally the
+ * environment variable, then the ~/.cups/client.conf file, and finally the
  * /etc/cups/client.conf file. If not set, the default is
- * HTTP_ENCRYPT_IF_REQUESTED.
+ * @code HTTP_ENCRYPT_IF_REQUESTED@.
  */
 
 http_encryption_t                      /* O - Encryption settings */
@@ -142,7 +133,7 @@ cupsEncryption(void)
 /*
  * 'cupsGetPassword()' - Get a password from the user.
  *
- * Uses the current password callback function. Returns NULL if the
+ * Uses the current password callback function. Returns @code NULL@ if the
  * user does not provide a password.
  */
 
@@ -160,7 +151,13 @@ cupsGetPassword(const char *prompt)        /* I - Prompt string */
 void
 cupsSetEncryption(http_encryption_t e) /* I - New encryption preference */
 {
-  _cupsGlobals()->encryption = e;
+  _cups_globals_t *cg = _cupsGlobals();        /* Pointer to library globals */
+
+
+  cg->encryption = e;
+
+  if (cg->http)
+    httpEncryption(cg->http, e);
 }
 
 
@@ -275,7 +272,7 @@ cupsServer(void)
 /*
  * 'cupsSetPasswordCB()' - Set the password callback for CUPS.
  *
- * Pass NULL to restore the default (console) password callback.
+ * Pass @code NULL@ to restore the default (console) password callback.
  */
 
 void
@@ -295,7 +292,7 @@ cupsSetPasswordCB(cups_password_cb_t cb)/* I - Callback function */
  * 'cupsSetServer()' - Set the default server name.
  *
  * The "server" string can be a fully-qualified hostname, a numeric
- * IPv4 or IPv6 address, or a domain socket pathname. Pass NULL to
+ * IPv4 or IPv6 address, or a domain socket pathname. Pass @code NULL@ to
  * restore the default server name.
  */
 
@@ -328,13 +325,19 @@ cupsSetServer(const char *server) /* I - Server name */
     cg->server[0]     = '\0';
     cg->servername[0] = '\0';
   }
+
+  if (cg->http)
+  {
+    httpClose(cg->http);
+    cg->http = NULL;
+  }
 }
 
 
 /*
  * 'cupsSetUser()' - Set the default user name.
  *
- * Pass NULL to restore the default user name.
+ * Pass @code NULL@ to restore the default user name.
  */
 
 void
@@ -500,5 +503,5 @@ cups_open_client_conf(void)
 
 
 /*
- * End of "$Id: usersys.c 5902 2006-08-29 15:51:19Z mike $".
+ * End of "$Id: usersys.c 6649 2007-07-11 21:46:42Z mike $".
  */