Provided by: libgnuspool-dev_1.7ubuntu1_amd64
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: unsigned char spu_isvalid Valid user ID char spu_resvd1[] Reserved int_ugid_t spu_user User ID 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 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 gspool_getspu() returns 0 if successful otherwise one of the following codes: GSPOOL_UNKNOWN_USER Invalid user name GSPOOL_INVALID_FD Invalid File descriptor GSPOOL_BADWRITE failure writing to the network GSPOOL_BADREAD failure reading from the network GSPOOL_NOPERM The user does not have permission
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).
COPYRIGHT
Copyright (c) 2009 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law.
AUTHOR
John M Collins, Xi Software Ltd.