disp1.c revision f0b87b902adb4cdfe4ad24ea596a7311ddbb2953
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include "dispatch.h"
#include <syslog.h>
static char *reqpath(char *, char **);
/**
** s_alloc_files()
**/
{
char *file_prefix;
/*
* Bugid 4140311
* Set umask to 0 before creating files.
*/
}
else
return;
}
/**
** s_print_request()
**/
{
extern char *Local_System;
char *file;
char *idno;
char *path;
char *req_file;
char *req_id = 0;
REQUEST *r;
SECURE *s;
short err;
short status;
#ifdef LP_USE_PAPI_ATTR
#endif
/*
* "NewRequest" points to a request that's not yet in the
* request list but is to be considered with the rest of the
* requests (e.g. calculating # of requests awaiting a form).
*/
else
{
if (!(r = Getrequest(req_file)))
else
{
endpwent();
else {
}
goto Return;
}
}
if (size < 0) {
/* at this point, chfiles() may have failed because the
* the file may live on an NFS mounted filesystem, under
* a directory of mode 700. such a directory isn't
* accessible even by root, according to the NFS protocol
* (i.e. the Stat() in chfiles() failed). this most commonly
* happens via the automounter, and rlogin.
*
* try again. if *this* fails, then the file must really
* be inaccessible.
*/
goto Return;
}
goto Return;
}
note("s_print_request(): ");
size = -1;
}
note("s_print_request(): ");
size = -1;
}
if (size < 0) {
goto Return;
}
}
goto Return;
}
else {
char *r;
r++;
else
}
}
else {
/*
* "req_id" will be supplied if this is from a
* remote system.
*/
{
} else
#ifdef LP_USE_PAPI_ATTR
/*
* Check if the PAPI job attribute file exists, if it does
* change the permissions and ownership of the file. This file
* is created when print jobs are submitted via the PAPI
* interface, the file pathname of this file is passed to
* the slow-filters and printer interface script as an
* environment variable when they are executed
*/
{
"s_print_request: attribute file ='%s'", path);
/*
* IPP job attribute file exists for this job so
* change permissions and ownership of the file
*/
}
else
{
}
#endif
/* fix for bugid 1103890. use Putsecure instead. */
if (
)
else
{
NewRequest = 0;
else
}
}
}
}
NewRequest = 0;
}
return;
}
/**
** s_start_change_request()
**/
{
char *req_id;
char *req_file = "";
short status;
char *path;
else {
if (
)
{
}
if (
)
{
}
/*
* Change the ownership of the request file to be "md->uid".
* Either this is identical to "rp->secure->uid", or it is
* "Lp_Uid" or it is root. The idea is that the
* person at the other end needs access, and that may not
* be who queued the request.
*/
#ifdef LP_USE_PAPI_ATTR
/*
* Check if the PAPI job attribute file exists, if it does
* change the ownership of the file to be "md->uid".
* Either this is identical to "rp->secure->uid", or it is
* "Lp_Uid" or it is root. The idea is that the
* person at the other end needs access, and that may not
* be who queued the request.
*/
{
"s_start_change_request: attribute file ='%s'", path);
/*
* IPP job attribute file exists for this job so
* change permissions and ownership of the file
*/
}
else
{
"s_start_change_request: no attribute file");
}
#endif
}
return;
}
/**
** s_end_change_request()
**/
{
char *req_id;
short err;
short status;
REQUEST *r = 0;
int call_schedule = 0;
int move_ok = 0;
char *path;
else {
#ifdef LP_USE_PAPI_ATTR
/*
* Check if the PAPI job attribute file exists, if it does
* change the permission and the ownership of the file to be "Lp_Uid".
*/
{
"s_end_change_request: attribute file ='%s'", path);
/*
* IPP job attribute file exists for this job so
* change permissions and ownership of the file
*/
}
else
{
"s_end_change_request: no attribute file");
}
#endif
/*
* The RS_CHANGING bit may have been the only thing preventing
* this request from filtering or printing, so regardless of what
* happens below, we must check to see if the request can proceed.
*/
call_schedule = 1;
else {
/*
* Preserve the current request status!
*/
/*
* Here's an example of the dangers one meets when public
* flags are used for private purposes. ".actions" (indeed,
* anything in the REQUEST structure) is set by the person
* changing the job. However, lpsched uses ".actions" as
* place to indicate that a job came from a remote system
* and we must send back job completion--this is a strictly
* private flag that we must preserve.
*/
/*
* To be here means either the user owns the request
* or he or she is the administrator. Since we don't
* want to set the RS_ADMINHELD flag if the user is
* the administrator, the following compare will work.
*/
}
goto Return;
}
}
{
goto Return;
}
}
if (size < 0) {
goto Return;
}
goto Return;
}
if (move_ok == 0) {
!= MOK) {
} else {
}
freerequest(&oldr);
/* fix for bugid 1103890. use Putsecure instead. */
}
}
}
if (r) {
freerequest(r);
}
}
if (call_schedule)
return;
}
/**
** _cancel()
** user may be (host!user)
**/
static char *
{
static char *s_dest;
static char *s_user;
static char *s_req_id;
static int current;
char *creq_id;
else
rp = Request_List;
current = 0;
current = 1;
}
}
continue;
continue;
continue;
continue;
}
/*
* For Trusted Extensions, we need to check the sensitivity label of the
* connection and job before we try to cancel it.
*/
continue;
else
return(creq_id);
}
return(NULL);
}
/**
** s_cancel_request()
**/
{
short status;
}
/**
** s_cancel()
**/
{
char *req_id;
char *user;
char *destination;
char *rid;
char *nrid;
int nerrno;
int oerrno;
destination = "";
req_id = "";
}
return;
}
}
/*
* s_inquire_request_rank()
*/
{
char *form;
char *dest;
char *pwheel;
char *user;
char *req_id;
int found_rank = 0;
short prop;
int i;
continue;
continue;
continue;
}
continue;
continue;
continue;
/*
* For Trusted Extensions, we need to check the sensitivity
* label of the connection and job before we return it to the
* client.
*/
continue;
if (found) {
/* bgolden 091996, bug 1257405 */
);
}
}
if (found) {
MOK,
);
} else
0, "", "", "", 0, "");
}
static int
{
int stat;
char *olddest;
char * reqno;
int cnt = 0;
char *reqno;
char **listp;
char tmp_nam[MAXPATHLEN];
cnt++;
}
}
note("putrequest failed\n");
return (MNOMEM);
}
return (MNOMEM);
/* remove the old request file; save new one */
/* Putsecure includes note/errmessage */
return (MNOMEM);
}
} else {
note("Getsecure failed\n");
return (MNOMEM);
}
/* update internal jobs list: Request_list */
/*
* We calloc'd securep->reqid earlier, now we free it
* here because we no longer call 'freesecure' from
* Putsecure() if we use a static structure
*/
} else {
note("request_by_id failed\n");
return (MUNKNOWN);
}
/*
* If the request was being filtered or was printing,
* it would have been stopped in "validate_request()",
* but only if it has to be refiltered. Thus, the
* filtering has been stopped if it has to be stopped,
* but the printing may still be going.
*/
}
return (MOK);
}
return (stat);
}
/*
* s_move_request()
*/
{
short err;
char *req_id;
char *dest;
return;
}
return;
}
return;
}
return;
}
return;
}
return;
}
}
/**
** s_move_dest()
**/
{
char *dest;
char *fromdest;
char *found = (char *)0;
short num_ok = 0;
{
return;
}
{
return;
}
{
return;
}
num_ok++;
continue;
}
}
if (found)
}
if (found)
else
}
/**
** reqpath
**/
static char *
{
char *path;
char *cp;
char *cp2;
/*
** 123-0
** machine/123-0
**
*/
if (*file == '/')
{
/*CONSTCOND*/
else
else
{
return(NULL);
}
{
cp += 5;
}
else
}
else
{
else
}
cp++;
else
{
*cp2 = '\0';
*cp2 = '-';
}
return(path);
}
/*
* The client is sending a peer connection to retrieve label information
* from. This is used in the event that the client is an intermediary for
* the actual requestor in a Trusted environment.
*/
{
short status = MTRANSMITERR;
char *dest;
(void) getmessage(m, S_PASS_PEER_CONNECTION);
}
}
}