/[monit]/monit/p.y
ViewVC logotype

Diff of /monit/p.y

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.104 by martinp, Wed Aug 6 20:40:01 2003 UTC revision 1.105 by martinp, Wed Aug 6 23:12:26 2003 UTC
# Line 496  allow           : ALLOW STRING':'STRING Line 496  allow           : ALLOW STRING':'STRING
496                  ;                  ;
497    
498  checkproc       : CHECKPROC SERVICENAME PIDFILE PATH {  checkproc       : CHECKPROC SERVICENAME PIDFILE PATH {
499                     createservice(TYPE_PROCESS, $<string>2,$4);                     createservice(TYPE_PROCESS, $<string>2, $4);
500                     check_name($<string>2);                     check_name($<string>2);
501                    }                    }
502                  | CHECKPROC SERVICENAME PATHTOK PATH {                  | CHECKPROC SERVICENAME PATHTOK PATH {
503                     createservice(TYPE_PROCESS, $<string>2,$4);                     createservice(TYPE_PROCESS, $<string>2, $4);
504                     check_name($<string>2);                     check_name($<string>2);
505                    }                    }
506                  ;                  ;
507    
508  checkfile       : CHECKFILE SERVICENAME PATHTOK PATH {  checkfile       : CHECKFILE SERVICENAME PATHTOK PATH {
509                     createservice(TYPE_FILE, $<string>2,$4);                     createservice(TYPE_FILE, $<string>2, $4);
510                     check_name($<string>2);                     check_name($<string>2);
511                    }                    }
512                  ;                  ;
513    
514  checkdev        : CHECKDEV SERVICENAME PATHTOK PATH {  checkdev        : CHECKDEV SERVICENAME PATHTOK PATH {
515                     createservice(TYPE_DEVICE, $<string>2,$4);                     createservice(TYPE_DEVICE, $<string>2, $4);
516                     check_name($<string>2);                     check_name($<string>2);
517                    }                    }
518                  ;                  ;
519    
520  checkdir        : CHECKDIR SERVICENAME PATHTOK PATH {  checkdir        : CHECKDIR SERVICENAME PATHTOK PATH {
521                     createservice(TYPE_DIRECTORY, $<string>2,$4);                     createservice(TYPE_DIRECTORY, $<string>2, $4);
522                     check_name($<string>2);                     check_name($<string>2);
523                    }                    }
524                  ;                  ;
# Line 1391  static void adduid(char *user, uid_t uid Line 1391  static void adduid(char *user, uid_t uid
1391      struct passwd *r;      struct passwd *r;
1392    
1393      if(user) {      if(user) {
1394          
1395  #ifdef HAVE_GETPWNAM_R  #ifdef HAVE_GETPWNAM_R
1396        if((0 != getpwnam_r(user, &pwd, buf, 1024, &r)) || !r) {        if((0 != getpwnam_r(user, &pwd, buf, 1024, &r)) || !r) {
1397  #else  #else
1398          r = getpwnam(user);        r = getpwnam(user);
1399          if ( r == NULL ) {        if ( r == NULL ) {
1400  #endif  #endif
1401            
1402         log("%s: Requested user '%s' not found on the system. Error at line %d\n",         log("%s: Requested user '%s' not found on the system. Error at line %d\n",
1403             prog, user, lineno);             prog, user, lineno);
1404         cfg_errflag++;         cfg_errflag++;
1405          
1406        }        }
1407          
1408      } else {      } else {
1409          
1410  #ifdef HAVE_GETPWUID_R  #ifdef HAVE_GETPWUID_R
1411        if((0 != getpwuid_r(uid, &pwd, buf, 1024, &r)) || !r) {        if((0 != getpwuid_r(uid, &pwd, buf, 1024, &r)) || !r) {
1412  #else  #else
1413        r = getpwuid(uid);        r = getpwuid(uid);
1414        if ( r == NULL ) {        if ( r == NULL ) {
1415  #endif      #endif    
1416            
1417         log("%s: Requested uid '%d' not found on the system. Error at line %d\n",         log("%s: Requested uid '%d' not found on the system. Error at line %d\n",
1418             prog, uid, lineno);             prog, uid, lineno);
1419         cfg_errflag++;         cfg_errflag++;
1420          
1421        }        }
1422          
1423      }      }
1424      
1425      if(r) {      if(r) {
         
1426        command->has_uid= TRUE;        command->has_uid= TRUE;
1427        command->uid= r->pw_uid;        command->uid= r->pw_uid;
1428              }
1429        }  
       
1430    } else {    } else {
1431        
1432      log("%s: Ignoring uid statement at line %d, not running as root.\n",      log("%s: Ignoring uid statement at line %d, not running as root.\n",
1433          prog, lineno);          prog, lineno);
1434        
1435    }    }
1436      
1437  }  }
1438    
1439    
# Line 1512  static void setlogfile(char *logfile) { Line 1510  static void setlogfile(char *logfile) {
1510            
1511      if(IS(Run.logfile, logfile)) {      if(IS(Run.logfile, logfile)) {
1512                
1513          free(logfile);
1514        return;        return;
1515                
1516      } else {      } else {
# Line 1535  static void setpidfile(char *pidfile) { Line 1534  static void setpidfile(char *pidfile) {
1534            
1535      if(IS(Run.pidfile, pidfile)) {      if(IS(Run.pidfile, pidfile)) {
1536                
1537          free(pidfile);
1538        return;        return;
1539                
1540      } else {      } else {
# Line 1560  static void setmailserver(char *mailserv Line 1560  static void setmailserver(char *mailserv
1560            
1561      if(IS(Run.mailserver, mailserver)) {      if(IS(Run.mailserver, mailserver)) {
1562                
1563          free(mailserver);
1564        return;        return;
1565                
1566      } else {      } else {
# Line 1585  static void setuname(char *uname) { Line 1586  static void setuname(char *uname) {
1586            
1587      if(IS(Run.Auth.uname, uname)) {      if(IS(Run.Auth.uname, uname)) {
1588                
1589          free(uname);
1590        return;        return;
1591                
1592      } else {      } else {

Legend:
Removed from v.1.104  
changed lines
  Added in v.1.105

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26