Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 8ed41c5f72 |
+1
-1
@@ -1,4 +1,4 @@
|
||||
README - CUPS v1.0b8 - 08/31/1999
|
||||
README - CUPS v1.0b9 - 09/03/1999
|
||||
---------------------------------
|
||||
|
||||
BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE BETA SOFTWARE
|
||||
|
||||
@@ -336,6 +336,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are chunking the output from stdin, make sure we end up with
|
||||
* a 0-length chunk at the end...
|
||||
*/
|
||||
|
||||
if (fp == stdin)
|
||||
httpWrite(http, buffer, 0);
|
||||
|
||||
fputs("INFO: Print file sent; checking status...\n", stderr);
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
* Version of software...
|
||||
*/
|
||||
|
||||
#define CUPS_SVERSION "CUPS v1.0b8"
|
||||
#define CUPS_SVERSION "CUPS v1.0b9"
|
||||
|
||||
/*
|
||||
* Where are files stored?
|
||||
|
||||
+18
-6
@@ -329,7 +329,10 @@ httpReconnect(http_t *http) /* I - HTTP data */
|
||||
*/
|
||||
|
||||
if ((http->fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
http->error = errno;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#ifdef FD_CLOEXEC
|
||||
fcntl(http->fd, F_SETFD, FD_CLOEXEC); /* Close this socket when starting *
|
||||
@@ -351,6 +354,8 @@ httpReconnect(http_t *http) /* I - HTTP data */
|
||||
if (connect(http->fd, (struct sockaddr *)&(http->hostaddr),
|
||||
sizeof(http->hostaddr)) < 0)
|
||||
{
|
||||
http->error = errno;
|
||||
|
||||
#ifdef WIN32
|
||||
closesocket(http->fd);
|
||||
#else
|
||||
@@ -359,6 +364,8 @@ httpReconnect(http_t *http) /* I - HTTP data */
|
||||
|
||||
return (-1);
|
||||
}
|
||||
else
|
||||
http->error = 0;
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -724,6 +731,8 @@ httpRead(http_t *http, /* I - HTTP data */
|
||||
|
||||
if (bytes > 0)
|
||||
http->data_remaining -= bytes;
|
||||
else if (bytes < 0)
|
||||
http->error = errno;
|
||||
|
||||
if (http->data_remaining == 0)
|
||||
{
|
||||
@@ -841,7 +850,6 @@ httpGets(char *line, /* I - Line to read into */
|
||||
*bufptr, /* Pointer into input buffer */
|
||||
*bufend; /* Pointer to end of buffer */
|
||||
int bytes; /* Number of bytes read */
|
||||
int lasterror; /* Last error received */
|
||||
|
||||
|
||||
DEBUG_printf(("httpGets(%08x, %d, %08x)\n", line, length, http));
|
||||
@@ -853,8 +861,7 @@ httpGets(char *line, /* I - Line to read into */
|
||||
* Pre-scan the buffer and see if there is a newline in there...
|
||||
*/
|
||||
|
||||
lasterror = 0;
|
||||
errno = 0;
|
||||
errno = 0;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -879,9 +886,9 @@ httpGets(char *line, /* I - Line to read into */
|
||||
* Nope, can't get a line this time...
|
||||
*/
|
||||
|
||||
if (errno != lasterror)
|
||||
if (errno != http->error)
|
||||
{
|
||||
lasterror = errno;
|
||||
http->error = errno;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -890,7 +897,12 @@ httpGets(char *line, /* I - Line to read into */
|
||||
return (NULL);
|
||||
}
|
||||
else if (bytes == 0)
|
||||
{
|
||||
if (http->blocking)
|
||||
http->error = EPIPE;
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Yup, update the amount used and the end pointer...
|
||||
@@ -1173,7 +1185,7 @@ httpUpdate(http_t *http) /* I - HTTP data */
|
||||
* See if there was an error...
|
||||
*/
|
||||
|
||||
if (errno)
|
||||
if (http->error)
|
||||
return (HTTP_ERROR);
|
||||
|
||||
/*
|
||||
|
||||
@@ -221,6 +221,7 @@ typedef struct
|
||||
{
|
||||
int fd; /* File descriptor for this socket */
|
||||
int blocking; /* To block or not to block */
|
||||
int error; /* Last error on read */
|
||||
time_t activity; /* Time since last read/write */
|
||||
http_state_t state; /* State of client */
|
||||
http_status_t status; /* Status of last request */
|
||||
@@ -251,6 +252,7 @@ extern int httpCheck(http_t *http);
|
||||
extern void httpClose(http_t *http);
|
||||
extern http_t *httpConnect(const char *host, int port);
|
||||
extern int httpDelete(http_t *http, const char *uri);
|
||||
# define httpError(http) ((http)->error)
|
||||
extern void httpFlush(http_t *http);
|
||||
extern int httpGet(http_t *http, const char *uri);
|
||||
extern char *httpGets(char *line, int length, http_t *http);
|
||||
|
||||
@@ -89,9 +89,7 @@ ImageReadTIFF(image_t *img, /* IO - Image */
|
||||
* Open the TIFF file and get the required parameters...
|
||||
*/
|
||||
|
||||
#ifdef __hpux
|
||||
lseek(fileno(fp), 0, SEEK_SET); /* Work around "feature" in HP-UX stdio */
|
||||
#endif /* __hpux */
|
||||
lseek(fileno(fp), 0, SEEK_SET); /* Work around "feature" in some stdio's */
|
||||
|
||||
if ((tif = TIFFFdOpen(fileno(fp), "", "r")) == NULL)
|
||||
{
|
||||
|
||||
@@ -105,7 +105,6 @@ ImageOpen(char *filename, /* I - Filename of image */
|
||||
memset(header2, 0, sizeof(header2));
|
||||
fread(header2, 1, sizeof(header2), fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
lseek(fileno(fp), 0, SEEK_SET); /* Avoid standard C library bugs */
|
||||
|
||||
/*
|
||||
* Allocate memory...
|
||||
|
||||
@@ -1455,8 +1455,8 @@ pipe_command(client_t *con, /* I - Client connection */
|
||||
* Child comes here... Close stdin if necessary and dup the pipe to stdout.
|
||||
*/
|
||||
|
||||
setuid(User);
|
||||
setgid(Group);
|
||||
setuid(User);
|
||||
|
||||
if (infile)
|
||||
{
|
||||
|
||||
+38
-14
@@ -427,7 +427,8 @@ add_class(client_t *con, /* I - Client connection */
|
||||
* Class doesn't exist; see if we have a printer of the same name...
|
||||
*/
|
||||
|
||||
if (FindPrinter(resource + 9) != NULL)
|
||||
if ((pclass = FindPrinter(resource + 9)) != NULL &&
|
||||
!(pclass->type & CUPS_PRINTER_REMOTE))
|
||||
{
|
||||
/*
|
||||
* Yes, return an error...
|
||||
@@ -436,14 +437,25 @@ add_class(client_t *con, /* I - Client connection */
|
||||
send_ipp_error(con, IPP_NOT_POSSIBLE);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* No, add the pclass...
|
||||
*/
|
||||
|
||||
pclass = AddClass(resource + 9);
|
||||
/*
|
||||
* If we found a printer but didn't error out, then rename the printer to
|
||||
* printer@host...
|
||||
*/
|
||||
|
||||
if (pclass != NULL)
|
||||
{
|
||||
strcat(pclass->name, "@");
|
||||
strcat(pclass->name, pclass->hostname);
|
||||
SetPrinterAttrs(pclass);
|
||||
SortPrinters();
|
||||
}
|
||||
|
||||
/*
|
||||
* No, add the pclass...
|
||||
*/
|
||||
|
||||
pclass = AddClass(resource + 9);
|
||||
}
|
||||
else if (pclass->type & CUPS_PRINTER_REMOTE)
|
||||
{
|
||||
@@ -626,7 +638,8 @@ add_printer(client_t *con, /* I - Client connection */
|
||||
* Printer doesn't exist; see if we have a class of the same name...
|
||||
*/
|
||||
|
||||
if (FindClass(resource + 10) != NULL)
|
||||
if ((printer = FindClass(resource + 10)) != NULL &&
|
||||
!(printer->type & CUPS_PRINTER_REMOTE))
|
||||
{
|
||||
/*
|
||||
* Yes, return an error...
|
||||
@@ -635,14 +648,25 @@ add_printer(client_t *con, /* I - Client connection */
|
||||
send_ipp_error(con, IPP_NOT_POSSIBLE);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* No, add the printer...
|
||||
*/
|
||||
|
||||
printer = AddPrinter(resource + 10);
|
||||
/*
|
||||
* If we found a class but didn't error out, then rename the class to
|
||||
* class@host...
|
||||
*/
|
||||
|
||||
if (printer != NULL)
|
||||
{
|
||||
strcat(printer->name, "@");
|
||||
strcat(printer->name, printer->hostname);
|
||||
SetPrinterAttrs(printer);
|
||||
SortPrinters();
|
||||
}
|
||||
|
||||
/*
|
||||
* No, add the printer...
|
||||
*/
|
||||
|
||||
printer = AddPrinter(resource + 10);
|
||||
}
|
||||
else if (printer->type & CUPS_PRINTER_REMOTE)
|
||||
{
|
||||
|
||||
+7
-5
@@ -640,7 +640,8 @@ StartJob(int id, /* I - Job ID */
|
||||
{
|
||||
current->procs[i] = pid;
|
||||
|
||||
DEBUG_printf(("StartJob: started %s - pid = %d.\n", command, pid));
|
||||
LogMessage(LOG_DEBUG, "Started %s (PID %d) for job %d.", command, pid,
|
||||
current->id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,7 +689,8 @@ StartJob(int id, /* I - Job ID */
|
||||
{
|
||||
current->procs[i] = pid;
|
||||
|
||||
DEBUG_printf(("StartJob: started %s - pid = %d.\n", command, pid));
|
||||
LogMessage(LOG_DEBUG, "Started %s (PID %d) for job %d.", command, pid,
|
||||
current->id);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -799,7 +801,7 @@ UpdateJob(job_t *job) /* I - Job to check */
|
||||
loglevel = LOG_WARN;
|
||||
message = buffer + 8;
|
||||
}
|
||||
if (strncmp(buffer, "INFO:", 5) == 0)
|
||||
else if (strncmp(buffer, "INFO:", 5) == 0)
|
||||
{
|
||||
loglevel = LOG_INFO;
|
||||
message = buffer + 5;
|
||||
@@ -849,7 +851,7 @@ UpdateJob(job_t *job) /* I - Job to check */
|
||||
LogMessage(loglevel, "%s", message);
|
||||
|
||||
if ((loglevel >= LOG_INFO && !job->state) ||
|
||||
loglevel == LOG_ERROR)
|
||||
loglevel < LOG_INFO)
|
||||
strncpy(job->printer->state_message, message,
|
||||
sizeof(job->printer->state_message) - 1);
|
||||
}
|
||||
@@ -936,8 +938,8 @@ start_process(char *command, /* I - Full path to command */
|
||||
* Change user to something "safe"...
|
||||
*/
|
||||
|
||||
setuid(User);
|
||||
setgid(Group);
|
||||
setuid(User);
|
||||
|
||||
/*
|
||||
* Execute the command; if for some reason this doesn't work,
|
||||
|
||||
@@ -355,6 +355,9 @@ sigchld_handler(int sig) /* I - Signal number */
|
||||
{
|
||||
DEBUG_printf(("sigcld_handler: pid = %d, status = %d\n", pid, status));
|
||||
|
||||
if (status)
|
||||
LogMessage(LOG_ERROR, "PID %d crashed with status %d!", pid, status);
|
||||
|
||||
for (job = Jobs; job != NULL; job = job->next)
|
||||
if (job->state == IPP_JOB_PROCESSING)
|
||||
{
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário