Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 259045
Collapse All | Expand All

(-)gnome-cups-manager-0.33/libgnomecups/gnome-cups-permission.c (+18 lines)
Lines 28-39 Link Here
28
#include <unistd.h>
28
#include <unistd.h>
29
#include <sys/types.h>
29
#include <sys/types.h>
30
#include <string.h>
30
#include <string.h>
31
#include <grp.h>
31
32
32
static char *gnome_cups_app_path = NULL;
33
static char *gnome_cups_app_path = NULL;
33
34
34
gboolean
35
gboolean
35
gnome_cups_can_admin ()
36
gnome_cups_can_admin ()
36
{
37
{
38
	gid_t groups[NGROUPS_MAX];
39
	int numgrp, i;
40
	struct group *lpadm_grp;
41
42
	/* find group id of lpadmin */
43
	lpadm_grp = getgrnam( "lpadmin" );
44
45
	if( lpadm_grp ) {
46
		/* find out whether user is in group lpadmin */
47
		numgrp = getgroups( sizeof( groups ) / sizeof( gid_t ), groups );
48
		if( numgrp >= 0 )
49
			for( i = 0; i < numgrp; ++i ) {
50
				if( groups[i] == lpadm_grp->gr_gid )
51
					return 1;
52
			}
53
	}
54
37
	return (geteuid () == 0);
55
	return (geteuid () == 0);
38
}
56
}
39
57

Return to bug 259045