NAME

gspool_getspu - retrieve the permissions for a user


SYNOPSIS

#include <gspool.h>

int getspu(const int fd, const char *user, struct apispdet *res)


DESCRIPTION

The function gspool_getspu() is used to retrieve the defaults for a particular user

fd is a file descriptor previously returned by gspool_open

user is a pointer to the username of the user details being retrieved.

res is a descriptor, which upon return will contain the details of user. The structure apispdet is defined in the file gsapi.h, and contains the following fields:

Type Field Description
unsigned char spu_isvalid Valid user ID
char [] spu_resvd1 Reserved
int_ugid_t spu_user User ID
unsigned char spu_minp Minimum priority
unsigned char spu_maxp Maximum priority
unsigned char spu_defp Default priority
char [] spu_form Default form type
char [] spu_formallow Allowed form type pattern
char [] spu_ptr Default printer
char [] spu_ptrallow Allowed printer pattern
unsigned long spu_flgs Privilege flag
classcode_t spu_class Class of printers
unsigned char spu_cps Maximum copies allowed
unsigned char spu_version Release of GNUspool

The spu_flgs field of res will contain a combination of the following:

PV_ADMIN Administrator (edit admin file)
PV_SSTOP Can run sstop (can stop scheduler)
PV_FORMS Can use other forms than default
PV_CPRIO Can change priority on queue
PV_OTHERJ Can change other users' jobs
PV_PRINQ Can move to printer queue
PV_HALTGO Can halt, restart printer
PV_ANYPRIO Can set any priority on queue
PV_CDEFLT Can change own default priority
PV_ADDDEL Can add/delete printers
PV_COVER Can override class
PV_UNQUEUE Can unqueue jobs
PV_VOTHERJ Can view other jobs not neccesarily edit
PV_REMOTEJ Can access remote jobs
PV_REMOTEP Can access remote printers
PV_FREEZEOK Can save default options
PV_ACCESSOK Can access sub-screens
PV_OTHERP Can use other printers from default
ALLPRIVS A combination of all of the above


RETURN VALUES

The function returns 0 if successful otherwise one of the error codes listed in Chapter 3.


EXAMPLE

An example to view the privileges of user mark:

 int     fd, ret;
 struct apispdet res;
 fd = gspool_open("myhost", (char *)0, 0);
 if (fd < 0) { /* error handling */
     ...
 }
 ret = gspool_getspu(fd, "mark", &res);
 if (ret < 0) { /* error handling */
     ...
 }
 if (res.spu_flags & PV_HALTGO)
     printf("user mark cannot halt printers\n");
 printf("marks maximim priority is %d\n", res.spu_maxp);
 gspool_close(fd);


SEE ALSO

gspool_getspd(3), gspool_putspu(3), gspool_putspd(3).


AUTHOR

John M Collins, Xi Software Ltd.