perm.c (80294) | perm.c (87208) |
---|---|
1/* 2 * perm.c - check user permission for at(1) 3 * Copyright (C) 1994 Thomas Koenig 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#ifndef lint 27static const char rcsid[] = | 1/* 2 * perm.c - check user permission for at(1) 3 * Copyright (C) 1994 Thomas Koenig 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#ifndef lint 27static const char rcsid[] = |
28 "$FreeBSD: head/usr.bin/at/perm.c 80294 2001-07-24 14:15:51Z obrien $"; | 28 "$FreeBSD: head/usr.bin/at/perm.c 87208 2001-12-02 12:26:18Z markm $"; |
29#endif /* not lint */ 30 31/* System Headers */ 32 33#include <sys/types.h> 34#include <err.h> 35#include <errno.h> 36#include <pwd.h> 37#include <stddef.h> 38#include <stdio.h> 39#include <stdlib.h> 40#include <string.h> 41#include <unistd.h> 42 43/* Local headers */ 44 | 29#endif /* not lint */ 30 31/* System Headers */ 32 33#include <sys/types.h> 34#include <err.h> 35#include <errno.h> 36#include <pwd.h> 37#include <stddef.h> 38#include <stdio.h> 39#include <stdlib.h> 40#include <string.h> 41#include <unistd.h> 42 43/* Local headers */ 44 |
45#include "privs.h" | |
46#include "at.h" | 45#include "at.h" |
46#include "perm.h" 47#include "privs.h" |
|
47 48/* Macros */ 49 50#define MAXUSERID 10 51 52/* Structures and unions */ 53 54/* Function declarations */ --- 21 unchanged lines hidden (view full) --- 76 break; 77 } 78 } 79 fclose(fp); 80 free(buffer); 81 return found; 82} 83/* Global functions */ | 48 49/* Macros */ 50 51#define MAXUSERID 10 52 53/* Structures and unions */ 54 55/* Function declarations */ --- 21 unchanged lines hidden (view full) --- 77 break; 78 } 79 } 80 fclose(fp); 81 free(buffer); 82 return found; 83} 84/* Global functions */ |
84int check_permission() | 85int check_permission(void) |
85{ 86 FILE *fp; 87 uid_t uid = geteuid(); 88 struct passwd *pentry; 89 90 if (uid==0) 91 return 1; 92 --- 33 unchanged lines hidden --- | 86{ 87 FILE *fp; 88 uid_t uid = geteuid(); 89 struct passwd *pentry; 90 91 if (uid==0) 92 return 1; 93 --- 33 unchanged lines hidden --- |