Skip to content

Commit

Permalink
Load cups into easysw/current.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh:https://src.apple.com/svn/cups/easysw/current@113 a1ca3aef-8c08-0410-bb20-df032aa958be
  • Loading branch information
jlovell committed Apr 4, 2006
1 parent 80ca459 commit d6ae789
Show file tree
Hide file tree
Showing 32 changed files with 750 additions and 294 deletions.
38 changes: 37 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
CHANGES.txt - 2006-03-24
CHANGES.txt - 2006-04-03
------------------------

CHANGES IN CUPS V1.2

- The PostScript filter now handles files that start with
an incomplete PJL header (PR #6076)
- The web interface language selection code did not try
the generic language localization (STR #1531)
- The language cache, string pool, and transcoding caches
are now process global instead of per-thread to avoid
problems with GNOME and to allow for data sharing
between threads (STR #1530)
- Fixed a CUPS 1.1.x compatibility bug (STR #1528)
- The web interface redirection after certain printer
administration tasks was broken (STR #1516)
- Web interface authorization could get stuck (STR #1512)
- Localization updates (STR #1513, STR #1518, STR #1520)
- The pstops filter didn't work with some files (STR
#1523)
- "./configure --enable-static" didn't work (STR #1522)
- The scheduler was not using the configured default
Group (STR #1521)
- The web interface still did not show the localized time
and date for some locales and systems (STR #1509)
- httpAddrGetList() would crash on systems without
getaddrinfo().
- Socket URIs without a trailing slash would cause the
port number to not be accepted (STR #1519)
- Local raw and System V printers were not advertised as
such for printer browsing (STR #1502)
- The RPM spec file incorrectly put duplicate copies of
the Japanese and Spanish web interface templates in the
main cups package (STR #1517)
- cupsSetDests() did not explicitly set the permissions
of the /etc/cups/lpoptions file (STR #1508)
- The lpq command crashed with the -h option (STR #1515)


CHANGES IN CUPS V1.2rc1

- Documentation updates (STR #1497, STR #1498)
Expand Down
66 changes: 46 additions & 20 deletions berkeley/lpq.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* "$Id: lpq.c 5023 2006-01-29 14:39:44Z mike $"
* "$Id: lpq.c 5345 2006-03-28 16:00:17Z mike $"
*
* "lpq" command for the Common UNIX Printing System (CUPS).
*
Expand Down Expand Up @@ -49,6 +49,7 @@
* Local functions...
*/

static http_t *connect_server(const char *, http_t *);
static int show_jobs(const char *, http_t *, const char *,
const char *, const int, const int);
static void show_printer(const char *, http_t *, const char *);
Expand Down Expand Up @@ -76,35 +77,23 @@ main(int argc, /* I - Number of command-line arguments */
int num_dests; /* Number of destinations */
cups_dest_t *dests; /* Destinations */
cups_lang_t *language; /* Language */
#ifdef HAVE_SSL
http_encryption_t encryption; /* Encryption? */
#endif /* HAVE_SSL */


language = cupsLangDefault();

/*
* Connect to the scheduler...
*/

if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
cupsEncryption())) == NULL)
{
_cupsLangPrintf(stderr, _("%s: Unable to contact server!\n"), argv[0]);
return (1);
}

/*
* Check for command-line options...
*/

http = NULL;
dest = NULL;
user = NULL;
id = 0;
interval = 0;
longstatus = 0;
all = 0;
num_dests = cupsGetDests(&dests);
language = cupsLangDefault();
num_dests = 0;

for (i = 1; i < argc; i ++)
if (argv[i][0] == '+')
Expand All @@ -115,10 +104,10 @@ main(int argc, /* I - Number of command-line arguments */
{
case 'E' : /* Encrypt */
#ifdef HAVE_SSL
encryption = HTTP_ENCRYPT_REQUIRED;
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);

if (http)
httpEncryption(http, encryption);
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
#else
_cupsLangPrintf(stderr,
_("%s: Sorry, no encryption support compiled in!\n"),
Expand Down Expand Up @@ -166,6 +155,11 @@ main(int argc, /* I - Number of command-line arguments */
if ((instance = strchr(dest, '/')) != NULL)
*instance++ = '\0';

http = connect_server(argv[0], http);

if (num_dests == 0)
num_dests = cupsGetDests2(http, &dests);

if (cupsGetDest(dest, instance, num_dests, dests) == NULL)
{
if (instance)
Expand All @@ -186,8 +180,11 @@ main(int argc, /* I - Number of command-line arguments */
break;

case 'h' : /* Connect to host */
if (http != NULL)
if (http)
{
httpClose(http);
http = NULL;
}

if (argv[i][2] != '\0')
cupsSetServer(argv[i] + 2);
Expand Down Expand Up @@ -225,8 +222,13 @@ main(int argc, /* I - Number of command-line arguments */
else
user = argv[i];

http = connect_server(argv[0], http);

if (dest == NULL && !all)
{
if (num_dests == 0)
num_dests = cupsGetDests2(http, &dests);

for (i = 0; i < num_dests; i ++)
if (dests[i].is_default)
dest = dests[i].name;
Expand Down Expand Up @@ -294,6 +296,30 @@ main(int argc, /* I - Number of command-line arguments */
}


/*
* 'connect_server()' - Connect to the server as necessary...
*/

static http_t * /* O - New HTTP connection */
connect_server(const char *command, /* I - Command name */
http_t *http) /* I - Current HTTP connection */
{
if (!http)
{
http = httpConnectEncrypt(cupsServer(), ippPort(),
cupsEncryption());

if (http == NULL)
{
_cupsLangPrintf(stderr, _("%s: Unable to connect to server\n"), command);
exit(1);
}
}

return (http);
}


/*
* 'show_jobs()' - Show jobs.
*/
Expand Down Expand Up @@ -651,5 +677,5 @@ usage(void)


/*
* End of "$Id: lpq.c 5023 2006-01-29 14:39:44Z mike $".
* End of "$Id: lpq.c 5345 2006-03-28 16:00:17Z mike $".
*/
16 changes: 12 additions & 4 deletions cgi-bin/admin.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* "$Id: admin.c 5290 2006-03-14 21:43:57Z mike $"
* "$Id: admin.c 5360 2006-03-30 17:02:17Z mike $"
*
* Administration CGI for the Common UNIX Printing System (CUPS).
*
Expand Down Expand Up @@ -132,12 +132,20 @@ main(int argc, /* I - Number of command-line arguments */
if (!strcmp(op, "redirect"))
{
const char *url; /* Redirection URL... */
char prefix[1024]; /* URL prefix */


if (getenv("HTTPS"))
snprintf(prefix, sizeof(prefix), "https://%s:%s",
getenv("SERVER_NAME"), getenv("SERVER_PORT"));
else
snprintf(prefix, sizeof(prefix), "http:https://%s:%s",
getenv("SERVER_NAME"), getenv("SERVER_PORT"));

if ((url = cgiGetVariable("URL")) != NULL)
printf("Location: %s\n\n", url);
printf("Location: %s%s\n\n", prefix, url);
else
puts("Location: /admin\n");
printf("Location: %s/admin\n\n", prefix);
}
else if (!strcmp(op, "start-printer"))
do_printer_op(http, IPP_RESUME_PRINTER, cgiText(_("Start Printer")));
Expand Down Expand Up @@ -2859,5 +2867,5 @@ match_string(const char *a, /* I - First string */


/*
* End of "$Id: admin.c 5290 2006-03-14 21:43:57Z mike $".
* End of "$Id: admin.c 5360 2006-03-30 17:02:17Z mike $".
*/
6 changes: 3 additions & 3 deletions cgi-bin/template.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* "$Id: template.c 5113 2006-02-16 12:02:44Z mike $"
* "$Id: template.c 5352 2006-03-29 16:26:38Z mike $"
*
* CGI template function.
*
Expand Down Expand Up @@ -110,7 +110,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
if ((lang = getenv("LANG")) != NULL)
{
for (i = 0; lang[i] && i < 15; i ++)
if (isalnum(lang[i] & 255))
if (isalnum(lang[i] & 255) || lang[i] == '_')
locale[i] = tolower(lang[i]);
else if (lang[i] == '-')
locale[i] = '_';
Expand Down Expand Up @@ -638,5 +638,5 @@ cgi_puts(const char *s, /* I - String to output */


/*
* End of "$Id: template.c 5113 2006-02-16 12:02:44Z mike $".
* End of "$Id: template.c 5352 2006-03-29 16:26:38Z mike $".
*/
9 changes: 5 additions & 4 deletions config-scripts/cups-common.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-common.m4 5288 2006-03-14 02:38:07Z mike $"
dnl "$Id: cups-common.m4 5354 2006-03-29 20:55:15Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
Expand Down Expand Up @@ -79,9 +79,10 @@ fi

dnl Static library option...
INSTALLSTATIC=""
AC_ARG_ENABLE(install_static, [ --enable-static install static libraries, default=no])
AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])

if test x$enable_install_static = xyes; then
if test x$enable_static = xyes; then
echo Installing static libraries...
INSTALLSTATIC="installstatic"
fi

Expand Down Expand Up @@ -264,5 +265,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)

dnl
dnl End of "$Id: cups-common.m4 5288 2006-03-14 02:38:07Z mike $".
dnl End of "$Id: cups-common.m4 5354 2006-03-29 20:55:15Z mike $".
dnl
10 changes: 4 additions & 6 deletions cups/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# "$Id: Makefile 5303 2006-03-18 01:05:59Z mike $"
# "$Id: Makefile 5354 2006-03-29 20:55:15Z mike $"
#
# API library Makefile for the Common UNIX Printing System (CUPS).
#
Expand Down Expand Up @@ -172,10 +172,8 @@ install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)

installstatic:
$(INSTALL_DIR) -m 755 $(LIBDIR)
if test $(LIBCUPS) != "libcups.a"; then \
$(INSTALL_LIB) libcups.a $(LIBDIR); \
$(RANLIB) $(LIBDIR)/libcups.a; \
fi
$(INSTALL_LIB) libcups.a $(LIBDIR)
$(RANLIB) $(LIBDIR)/libcups.a

installhdrs:
$(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
Expand Down Expand Up @@ -443,5 +441,5 @@ include Dependencies


#
# End of "$Id: Makefile 5303 2006-03-18 01:05:59Z mike $".
# End of "$Id: Makefile 5354 2006-03-29 20:55:15Z mike $".
#
10 changes: 7 additions & 3 deletions cups/auth.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* "$Id: auth.c 4918 2006-01-12 05:14:40Z mike $"
* "$Id: auth.c 5359 2006-03-30 16:09:30Z mike $"
*
* Authentication functions for the Common UNIX Printing System (CUPS).
*
Expand Down Expand Up @@ -92,9 +92,13 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
* See if we can do local authentication...
*/

if (!cups_local_auth(http))
if (http->digest_tries < 3 && !cups_local_auth(http))
{
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));

if (http->status == HTTP_UNAUTHORIZED)
http->digest_tries ++;

return (0);
}

Expand Down Expand Up @@ -245,5 +249,5 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */


/*
* End of "$Id: auth.c 4918 2006-01-12 05:14:40Z mike $".
* End of "$Id: auth.c 5359 2006-03-30 16:09:30Z mike $".
*/
14 changes: 12 additions & 2 deletions cups/dest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* "$Id: dest.c 5182 2006-02-26 04:10:27Z mike $"
* "$Id: dest.c 5346 2006-03-28 16:05:19Z mike $"
*
* User-defined destination (and option) support for the Common UNIX
* Printing System (CUPS).
Expand Down Expand Up @@ -531,6 +531,16 @@ cupsSetDests2(http_t *http, /* I - HTTP connection */
return (-1);
}

#ifndef WIN32
/*
* Set the permissions to 0644 when saving to the /etc/cups/lpoptions
* file...
*/

if (!getuid())
fchmod(fileno(fp), 0644);
#endif /* !WIN32 */

/*
* Write each printer; each line looks like:
*
Expand Down Expand Up @@ -998,5 +1008,5 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */


/*
* End of "$Id: dest.c 5182 2006-02-26 04:10:27Z mike $".
* End of "$Id: dest.c 5346 2006-03-28 16:05:19Z mike $".
*/

0 comments on commit d6ae789

Please sign in to comment.