perm.c (41556) | perm.c (48386) |
---|---|
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 --- 34 unchanged lines hidden (view full) --- 43 44#define MAXUSERID 10 45 46/* Structures and unions */ 47 48 49/* File scope variables */ 50 | 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 --- 34 unchanged lines hidden (view full) --- 43 44#define MAXUSERID 10 45 46/* Structures and unions */ 47 48 49/* File scope variables */ 50 |
51static const char rcsid[] = "$Id: perm.c,v 1.5 1997/02/22 19:54:08 peter Exp $"; | 51static const char rcsid[] = "$Id: perm.c,v 1.6 1998/12/06 07:42:09 archie Exp $"; |
52 53/* Function declarations */ 54 55static int check_for_user(FILE *fp,const char *name); 56 57/* Local functions */ 58 59static int check_for_user(FILE *fp,const char *name) --- 39 unchanged lines hidden (view full) --- 99 fp=fopen(PERM_PATH "at.allow","r"); 100 101 PRIV_END 102 103 if (fp != NULL) 104 { 105 return check_for_user(fp, pentry->pw_name); 106 } | 52 53/* Function declarations */ 54 55static int check_for_user(FILE *fp,const char *name); 56 57/* Local functions */ 58 59static int check_for_user(FILE *fp,const char *name) --- 39 unchanged lines hidden (view full) --- 99 fp=fopen(PERM_PATH "at.allow","r"); 100 101 PRIV_END 102 103 if (fp != NULL) 104 { 105 return check_for_user(fp, pentry->pw_name); 106 } |
107 else | 107 else if (errno == ENOENT) |
108 { 109 110 PRIV_START 111 112 fp=fopen(PERM_PATH "at.deny", "r"); 113 114 PRIV_END 115 116 if (fp != NULL) 117 { 118 return !check_for_user(fp, pentry->pw_name); 119 } | 108 { 109 110 PRIV_START 111 112 fp=fopen(PERM_PATH "at.deny", "r"); 113 114 PRIV_END 115 116 if (fp != NULL) 117 { 118 return !check_for_user(fp, pentry->pw_name); 119 } |
120 perror("at.deny"); | 120 else if (errno != ENOENT) 121 perror("at.deny"); |
121 } | 122 } |
123 else 124 perror("at.allow"); |
|
122 return 0; 123} | 125 return 0; 126} |