[Spread-cvs] cvs commit: spread/daemon Readme.txt alarm.c alarm.h auth-ip.c auth-null.c auth-pword.c config_gram.l config_parse.y monitor.c sp.c spread.c

jonathan at spread.org jonathan at spread.org
Wed Nov 12 17:11:03 EST 2003


jonathan    03/11/12 17:11:03

  Modified:    daemon   Readme.txt alarm.c alarm.h auth-ip.c auth-null.c
                        auth-pword.c config_gram.l config_parse.y monitor.c
                        sp.c spread.c
  Log:
  Enhanced Alarm() to support priority levels. This change is currently in progress.
  Until all of the Alarm() calls are converted to the new syntax, the old Alarm()
  function will remain unchanged, and the new function is called Alarmp(). The new
  priority levels can be found in alarm.h. Some new support functions also were created
  Alarm_set_priority() Alarm_get_priority(). The spread.conf file now has a new
  option called "EventPriority" that allows you to set the active priority that should
  be output by alarm at runtime.
  
  Questions or discussion should go on the spread-users at lists.spread.org list.
  
  Revision  Changes    Path
  1.39      +3 -1      spread/daemon/Readme.txt
  
  Index: Readme.txt
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/Readme.txt,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- Readme.txt	24 Oct 2003 21:55:04 -0000	1.38
  +++ Readme.txt	12 Nov 2003 22:11:03 -0000	1.39
  @@ -57,7 +57,9 @@
   *) Fix group_id bug that causes incorrect vs_sets. Patch by Ryan Caudy.
   *) Fix spread.conf parser so it validates the machine names in segments
      and forces them to be less then MAX_PROC_NAME. Patch by Mikhail Terekhov.
  -
  +*) Minor fix to Mac OS X compilation so library softlinks do not fail the 
  +   second time make is run.
  +*) Alarm() changes to support priority levels on each Alarm() call. 
   
   
   June 20, 2003 Ver 3.17.1
  
  
  
  1.5       +60 -11    spread/daemon/alarm.c
  
  Index: alarm.c
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/alarm.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- alarm.c	22 Sep 2002 02:56:52 -0000	1.4
  +++ alarm.c	12 Nov 2003 22:11:03 -0000	1.5
  @@ -51,7 +51,9 @@
   
   #include "alarm.h"
   
  -static int32	Alarm_mask = PRINT | EXIT ;
  +static int32	Alarm_type_mask = PRINT | EXIT  ;
  +static  int16   Alarm_cur_priority = SPLOG_DEBUG ;
  +
   static char     *Alarm_timestamp_format = NULL;
   
   static const char *DEFAULT_TIMESTAMP_FORMAT="[%a %d %b %Y %H:%M:%S]";
  @@ -64,9 +66,47 @@
      developers...
   */
   
  +void Alarmp( int16 priority, int32 mask, char *message, ...)
  +{
  +    /* log event if in mask and of higher priority, or if FATAL event, always log */
  +    if ( (( Alarm_type_mask & mask ) && (Alarm_cur_priority <=  priority)) 
  +         || (priority == SPLOG_FATAL) )
  +        {
  +	    va_list ap;
  +
  +	    if ( Alarm_timestamp_format )
  +            {
  +	        char timestamp[42];
  +		struct tm *tm_now;
  +		time_t time_now;
  +		size_t length;
  +		
  +		time_now = time(NULL);
  +		tm_now = localtime(&time_now);
  +		length = strftime(timestamp, 40,
  +				  Alarm_timestamp_format, tm_now);
  +		timestamp[length] = ' ';
  +		fwrite(timestamp, length+1, sizeof(char), stdout);
  +            }
  +
  +	    va_start(ap,message);
  +	    vprintf(message, ap);
  +	    va_end(ap);
  +        }
  +
  +        if ( ( EXIT & mask ) || (priority == SPLOG_FATAL) )
  +	{
  +	    printf("Exit caused by Alarm(EXIT)\n");
  +            exit( 0 );
  +	}
  +}
  +
  +/* For backwards compatibility while moving all Alarm calls over, this provides
  + * the old interface and logs them as WARNING events.
  + */
   void Alarm( int32 mask, char *message, ...)
   {
  -	if ( Alarm_mask & mask )
  +        if ( ( Alarm_type_mask & mask ) && (Alarm_cur_priority <  SPLOG_WARNING) )
           {
   	    va_list ap;
   
  @@ -96,17 +136,16 @@
               exit( 0 );
   	}
   }
  -
   #else
   
  -void Alarm( int32 mask, char *message, 
  +void Alarm( int16 priority, int32 mask, char *message, 
                           void *ptr1, void *ptr2, void *ptr3, void *ptr4, 
                           void *ptr5, void *ptr6, void *ptr7, void *ptr8,
                           void *ptr9, void *ptr10, void*ptr11, void *ptr12,
                           void *ptr13, void *ptr14, void *ptr15, void *ptr16,
                           void *ptr17, void *ptr18, void *ptr19, void *ptr20)
   {
  -	if ( Alarm_mask & mask )
  +        if ( ( Alarm_type_mask & mask ) && (Alarm_cur_priority <  priority) )
           {
               if ( Alarm_timestamp_format )
               {
  @@ -173,17 +212,27 @@
           Alarm_timestamp_format = NULL;
   }
   
  -void Alarm_set(int32 mask)
  +void Alarm_set_types(int32 mask)
  +{
  +	Alarm_type_mask = Alarm_type_mask | mask;
  +}
  +
  +void Alarm_clear_types(int32 mask)
  +{
  +	Alarm_type_mask = Alarm_type_mask & ~mask;
  +}
  +
  +int32 Alarm_get_types(void)
   {
  -	Alarm_mask = Alarm_mask | mask;
  +        return(Alarm_type_mask);
   }
   
  -void Alarm_clear(int32 mask)
  +void Alarm_set_priority(int16 priority)
   {
  -	Alarm_mask = Alarm_mask & ~mask;
  +        Alarm_cur_priority = priority;
   }
   
  -int32 Alarm_get(void)
  +int16 Alarm_get_priority(void)
   {
  -        return(Alarm_mask);
  +        return(Alarm_cur_priority);
   }
  
  
  
  1.3       +25 -4     spread/daemon/alarm.h
  
  Index: alarm.h
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/alarm.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- alarm.h	22 Sep 2002 02:56:52 -0000	1.2
  +++ alarm.h	12 Nov 2003 22:11:03 -0000	1.3
  @@ -41,6 +41,8 @@
   #define		DEBUG		0x00000001
   #define 	EXIT  		0x00000002
   #define		PRINT		0x00000004
  +/* new type to replace general prints */
  +#define         SYSTEM          0x00000004
   
   #define		DATA_LINK	0x00000010
   #define		NETWORK		0x00000020
  @@ -64,12 +66,28 @@
   #define         SKIPLIST        0x00200000
   #define         ACM             0x00400000
   
  +#define         SEC             0x00800000
  +
   #define		ALL		0xffffffff
   #define		NONE		0x00000000
   
  +/* Priority levels */   
  +#define         SPLOG_DEBUG     1       /* Program information that is only useful for debugging. 
  +                                           Will normally be turned off in operation. */
  +#define         SPLOG_INFO      2       /* Program reports information that may be useful for 
  +                                           performance tuning, analysis, or operational checks. */
  +#define         SPLOG_WARNING   3       /* Program encountered a situation that is not erroneous, 
  +                                           but is uncommon and may indicate an error. */
  +#define         SPLOG_ERROR     4       /* Program encountered an error that can be recovered from. */
  +#define         SPLOG_CRITICAL  5       /* Program will not exit, but has only temporarily recovered 
  +                                           and without help may soon fail. */
  +#define         SPLOG_FATAL     6       /* Program will exit() or abort(). */
  +
  +#define         SPLOG_PRINT     7       /* Program should always print this information */
   
   #ifdef  HAVE_GOOD_VARGS
  -void Alarm( int32 mask, char *message, ...);
  +void Alarmp( int16 priority, int32 type, char *message, ...);
  +void Alarm( int32 type, char *message, ...);
   
   #else
   void Alarm();
  @@ -80,9 +98,12 @@
   void Alarm_enable_timestamp(char *format);
   void Alarm_disable_timestamp(void);
   
  -void Alarm_set(int32 mask);
  -void Alarm_clear(int32 mask);
  -int32 Alarm_get(void);
  +void Alarm_set_types(int32 mask);
  +void Alarm_clear_types(int32 mask);
  +int32 Alarm_get_types(void);
  +
  +void Alarm_set_priority(int16 priority);
  +int16 Alarm_get_priority(void);
   
   void Alarm_set_interactive(void);
   int  Alarm_get_interactive(void);
  
  
  
  1.6       +14 -14    spread/daemon/auth-ip.c
  
  Index: auth-ip.c
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/auth-ip.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- auth-ip.c	22 Sep 2002 02:56:52 -0000	1.5
  +++ auth-ip.c	12 Nov 2003 22:11:03 -0000	1.6
  @@ -84,21 +84,21 @@
   
       if (!Acm_auth_add_method("IP", &IP_ops))
       {
  -            Alarm( EXIT, "ip_init: Failed to register IP. Too many ACM methods registered. Recompile with larger limit.\n");
  +        Alarmp( SPLOG_FATAL, ACM, "ip_init: Failed to register IP. Too many ACM methods registered. Recompile with larger limit.\n");
       }
   
       /* load spread.access_ip file */
       if (NULL != (fp = fopen(file_name,"r")) )
  -        Alarm( PRINT, "ip_init: using file: %s\n", file_name);
  +        Alarmp( SPLOG_INFO, ACM, "ip_init: using file: %s\n", file_name);
       if (fp == NULL) 
           if (NULL != (fp = fopen("./spread.access_ip", "r")) )
  -            Alarm( PRINT, "ip_init: using file: ./spread.access_ip\n");
  +            Alarmp( SPLOG_INFO, ACM, "ip_init: using file: ./spread.access_ip\n");
       if (fp == NULL)
           if (NULL != (fp = fopen("/etc/spread.access_ip", "r")) )
  -            Alarm( PRINT, "ip_init: using file: /etc/spread.access_ip\n");
  +            Alarmp( SPLOG_INFO, ACM, "ip_init: using file: /etc/spread.access_ip\n");
       if (fp == NULL)
       {
  -        Alarm( PRINT, "ip_init: IP access control file not found.\nIf you are using IP based access controls, please make sure the file exists.\n");
  +        Alarmp( SPLOG_ERROR, ACM, "ip_init: IP access control file not found.\nIf you are using IP based access controls, please make sure the file exists.\n");
           IP_File_Loaded = FALSE;
           return;
       }
  @@ -112,14 +112,14 @@
           if ( line[0] == 'u' && line[1] == 'n' && line[2] == 'i' && line[3] == 'x')
           {
               /* Special rule for unix domain sockets */
  -            Alarm( PRINT, "ip_init: Allowing UNIX Domain Socket connections\n");
  +            Alarmp( SPLOG_INFO, ACM, "ip_init: Allowing UNIX Domain Socket connections\n");
               insert_ip_rule(0, 32);
               continue;
           }
           if ( line[0] == 'l' && line[1] == 'o' && line[2] == 'c' && line[3] == 'a' && line[4] == 'l')
           {
               /* special rule for localhost connections over tcp */
  -            Alarm( PRINT, "ip_init: Allowing localhost tcp Socket connections\n");
  +            Alarmp( SPLOG_INFO, ACM, "ip_init: Allowing localhost tcp Socket connections\n");
               localhost_ip = 127 << 24;
               insert_ip_rule(localhost_ip, 8);
               continue;
  @@ -129,7 +129,7 @@
               ret = strchr(line, '.' );
               if ( ret == NULL)
               {
  -                Alarm( PRINT, "ip_init: incomplete line: %s\n", line);
  +                Alarmp( SPLOG_ERROR, ACM, "ip_init: incomplete line: %s\n", line);
                   file_done = TRUE;
                   break;
               }
  @@ -141,9 +141,9 @@
                        &i1,&i2,&i3,&i4,&prefix);
           if( iret == 4 ) prefix = 32;
           else if( iret < 5 ) 
  -            Alarm( EXIT, "ip_init: not a valid ip network address/prefix line: %s\n", line);
  +            Alarmp( SPLOG_FATAL, ACM, "ip_init: not a valid ip network address/prefix line: %s\n", line);
   
  -        Alarm( ACM, "ip_init: network address %d.%d.%d.%d with prefix length: %d\n",
  +        Alarmp( SPLOG_INFO, ACM, "ip_init: network address %d.%d.%d.%d with prefix length: %d\n",
                  i1,i2,i3,i4, prefix);
   
           net_address = ( (i1 << 24 ) | (i2 << 16) | (i3 << 8) | i4 );
  @@ -161,7 +161,7 @@
       
       new_rule = malloc(sizeof(struct ip_rule));
       if (!new_rule)
  -        Alarm(EXIT, "insert_ip_rule: Failed to allocate a struct ip_rule\n");
  +        Alarmp(SPLOG_FATAL, ACM, "insert_ip_rule: Failed to allocate a struct ip_rule\n");
   
       new_rule->network_address = net_address;
       new_rule->prefix_length = prefix;
  @@ -184,7 +184,7 @@
   
       if (! IP_File_Loaded )
       {
  -        Alarm( PRINT, "ip_open_connection: No spread.access_ip file loaded. NO connections will be allowed!\nYou probably don't want this!!\n");
  +        Alarmp( SPLOG_CRITICAL, ACM,  "ip_open_connection: No spread.access_ip file loaded. NO connections will be allowed!\nYou probably don't want this!!\n");
           Sess_session_report_auth_result( sess_auth_p, FALSE );
           return;
       }
  @@ -195,11 +195,11 @@
       /* Search allowed lists */
       while(rule_p)
       {
  -        Alarm(ACM, "ip_open_connection: client_ip: %d.%d.%d.%d, prefix: %d premask: 0x%x mask: 0x%x\n",
  +        Alarmp(SPLOG_INFO, ACM, "ip_open_connection: client_ip: %d.%d.%d.%d, prefix: %d premask: 0x%x mask: 0x%x\n",
                 IP1(client_ip), IP2(client_ip), IP3(client_ip), IP4(client_ip), rule_p->prefix_length, ~0x0,
                 ( (~0x0) << (32 - rule_p->prefix_length)) );
           client_net = (client_ip & ( (~0x0) << (32 - rule_p->prefix_length)));
  -        Alarm(ACM, "ip_open_connection: comparing network %d.%d.%d.%d with client %d.%d.%d.%d\n",
  +        Alarm(SPLOG_INFO, ACM, "ip_open_connection: comparing network %d.%d.%d.%d with client %d.%d.%d.%d\n",
                 IP1(rule_p->network_address), IP2(rule_p->network_address), IP3(rule_p->network_address), 
                 IP4(rule_p->network_address), IP1(client_net),IP2(client_net),IP3(client_net),IP4(client_net) );
           if (rule_p->network_address == client_net)
  
  
  
  1.3       +1 -1      spread/daemon/auth-null.c
  
  Index: auth-null.c
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/auth-null.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- auth-null.c	22 Sep 2002 02:56:52 -0000	1.2
  +++ auth-null.c	12 Nov 2003 22:11:03 -0000	1.3
  @@ -55,7 +55,7 @@
       /* Unknown */
       if (!Acm_auth_add_method("NULL", &Null_ops) )
       {
  -            Alarm( EXIT, "null_init: Failed to register NULL. Too many ACM methods registered. Recompile with larger limit.\n");
  +        Alarmp( SPLOG_FATAL, ACM, "null_init: Failed to register NULL. Too many ACM methods registered. Recompile with larger limit.\n");
       }
   }
   
  
  
  
  1.4       +34 -34    spread/daemon/auth-pword.c
  
  Index: auth-pword.c
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/auth-pword.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- auth-pword.c	22 Sep 2002 02:56:52 -0000	1.3
  +++ auth-pword.c	12 Nov 2003 22:11:03 -0000	1.4
  @@ -109,23 +109,23 @@
   
       sprintf(file_name, "spread.access_pword");
   
  -    Alarm( PRINT, "pword_init: Starting\n");
  +    Alarmp( SPLOG_DEBUG, ACM, "pword_init: Starting\n");
       if (!Acm_auth_add_method("PWORD", &Pword_ops))
       {
  -            Alarm( EXIT, "pword_init: Failed to register PWORD. Too many ACM methods registered. Recompile with larger limit.\n");
  +        Alarmp( SPLOG_FATAL, ACM, "pword_init: Failed to register PWORD. Too many ACM methods registered. Recompile with larger limit.\n");
       }
   
       /* load spread.access_ip file */
       if (NULL != (fp = fopen(file_name,"r")) )
  -        Alarm( PRINT, "pword_init: using file: %s\n", file_name);
  +        Alarmp( SPLOG_INFO, ACM, "pword_init: using file: %s\n", file_name);
       if (fp == NULL) 
           if (NULL != (fp = fopen("./spread.access_pword", "r")) )
  -            Alarm( PRINT, "pword_init: using file: ./spread.access_pword\n");
  +            Alarmp( SPLOG_INFO,ACM, "pword_init: using file: ./spread.access_pword\n");
       if (fp == NULL)
           if (NULL != (fp = fopen("/etc/spread.access_pword", "r")) )
  -            Alarm( PRINT, "pword_init: using file: /etc/spread.access_pword\n");
  +            Alarmp( SPLOG_INFO, ACM, "pword_init: using file: /etc/spread.access_pword\n");
       if (fp == NULL)
  -        Alarm( EXIT, "pword_init: error opening config file %s in any of the standard locations. Please make sure the file exists\n", file_name);
  +        Alarmp( SPLOG_FATAL, ACM, "pword_init: error opening config file %s in any of the standard locations. Please make sure the file exists\n", file_name);
   
       do{
           ret = fgets(line,132,fp);
  @@ -138,7 +138,7 @@
   
           if ( ret == NULL)
           {
  -                Alarm( PRINT, "pwrod_init: incomplete line: %s\n", line);
  +            Alarmp( SPLOG_ERROR, ACM, "pword_init: incomplete line: %s\n", line);
                   file_done = TRUE;
                   break;
           }
  @@ -147,9 +147,9 @@
   
           iret = sscanf(line,"%32s %13s",username,password);
           if( iret < 2 ) 
  -            Alarm( EXIT, "pword_init: not a valid username:password entry. line: %s\n", line);
  +            Alarmp(SPLOG_FATAL, ACM, "pword_init: not a valid username:password entry. line: %s\n", line);
   
  -        Alarm( PRINT, "pword_init: loaded user %s with crypted password %s\n",username, password);
  +        Alarmp( SPLOG_INFO, ACM, "pword_init: loaded user %s with crypted password %s\n",username, password);
   
           insert_user(username, password);
       } while(TRUE);
  @@ -163,7 +163,7 @@
       
       new_user = malloc(sizeof(struct user_password));
       if (!new_user)
  -        Alarm(EXIT, "insert_user: Failed to allocate a struct user_password\n");
  +        Alarmp(SPLOG_FATAL, ACM, "insert_user: Failed to allocate a struct user_password\n");
   
       memcpy(new_user->username, username, MAX_PWORD_USERNAME);
       memcpy(new_user->crypt_pass, crypt_password, MAX_PWORD_CRYPTPASSWORD);
  @@ -187,10 +187,10 @@
       /* Search allowed lists */
       while(user_p)
       {
  -        Alarm( PRINT, "lookup_user: Checking user: %s with crypted password %s\n", user_p->username, user_p->crypt_pass);
  +        Alarmp( SPLOG_INFO, ACM, "lookup_user: Checking user: %s with crypted password %s\n", user_p->username, user_p->crypt_pass);
           if (!strncmp(username, user_p->username, MAX_PWORD_USERNAME) )
           {
  -            Alarm( PRINT, "lookup_user: Found user %s = %s with crypted password %s\n", username, user_p->username, user_p->crypt_pass);
  +            Alarmp( SPLOG_INFO, ACM, "lookup_user: Found user %s = %s with crypted password %s\n", username, user_p->username, user_p->crypt_pass);
               *user_h = user_p;
               return(TRUE);
           }
  @@ -214,7 +214,7 @@
           if (!strncmp(crypt_presented_pass, user_p->crypt_pass, 13)) {
               return(TRUE);
           } else {
  -            Alarm( ACM, "pword_auth_client_connection: Password (%s) did NOT match (%s) for user %s\n", crypt_presented_pass, user_p->crypt_pass, username);
  +            Alarmp( SPLOG_WARNING, ACM, "pword_auth_client_connection: Password (%s) did NOT match (%s) for user %s\n", crypt_presented_pass, user_p->crypt_pass, username);
               return(FALSE);
           }
       } else {
  @@ -249,39 +249,39 @@
       ret = recv( mbox, username, MAX_PWORD_USERNAME, 0 );
       if( ret < 0 )
       {
  -            Alarm( ACM, "auth_client_conn_read: reading username string failed on mailbox %d\n", mbox );
  -            ioctl_cmd = 0;
  -            ret = ioctl( mbox, FIONBIO, &ioctl_cmd);
  -            Sess_session_report_auth_result( sess_auth_p, FALSE);
  -            return;
  +        Alarmp( SPLOG_WARNING, ACM, "auth_client_conn_read: reading username string failed on mailbox %d\n", mbox );
  +        ioctl_cmd = 0;
  +        ret = ioctl( mbox, FIONBIO, &ioctl_cmd);
  +        Sess_session_report_auth_result( sess_auth_p, FALSE);
  +        return;
       }
       if( ret < MAX_PWORD_USERNAME )
       {
  -            Alarm( ACM, "auth_client_conn_read: reading username string SHORT on mailbox %d\n", mbox );
  -            ioctl_cmd = 0;
  -            ret = ioctl( mbox, FIONBIO, &ioctl_cmd);
  -            Sess_session_report_auth_result( sess_auth_p, FALSE);
  -            return;
  +        Alarmp( SPLOG_WARNING, ACM, "auth_client_conn_read: reading username string SHORT on mailbox %d\n", mbox );
  +        ioctl_cmd = 0;
  +        ret = ioctl( mbox, FIONBIO, &ioctl_cmd);
  +        Sess_session_report_auth_result( sess_auth_p, FALSE);
  +        return;
       }
       username[MAX_PWORD_USERNAME] = '\0';
   
       ret = recv( mbox, clear_password, MAX_PWORD_PASSWORD, 0 );
       if( ret < 0 )
       {
  -            Alarm( ACM, "auth_client_conn_read: reading password string failed on mailbox %d\n", mbox );
  -            /* set blocking and return failure to auth */
  -            ioctl_cmd = 0;
  -            ret = ioctl( mbox, FIONBIO, &ioctl_cmd);
  -            Sess_session_report_auth_result( sess_auth_p, FALSE);
  -            return;
  +        Alarmp( SPLOG_WARNING, ACM, "auth_client_conn_read: reading password string failed on mailbox %d\n", mbox );
  +        /* set blocking and return failure to auth */
  +        ioctl_cmd = 0;
  +        ret = ioctl( mbox, FIONBIO, &ioctl_cmd);
  +        Sess_session_report_auth_result( sess_auth_p, FALSE);
  +        return;
       }
       if( ret < MAX_PWORD_PASSWORD )
       {
  -            Alarm( ACM, "auth_client_conn_read: reading password string SHORT on mailbox %d\n", mbox );
  -            ioctl_cmd = 0;
  -            ret = ioctl( mbox, FIONBIO, &ioctl_cmd);
  -            Sess_session_report_auth_result( sess_auth_p, FALSE);
  -            return;
  +        Alarmp( SPLOG_WARNING, ACM, "auth_client_conn_read: reading password string SHORT on mailbox %d\n", mbox );
  +        ioctl_cmd = 0;
  +        ret = ioctl( mbox, FIONBIO, &ioctl_cmd);
  +        Sess_session_report_auth_result( sess_auth_p, FALSE);
  +        return;
       }
       clear_password[MAX_PWORD_PASSWORD] = '\0';
   
  
  
  
  1.9       +7 -0      spread/daemon/config_gram.l
  
  Index: config_gram.l
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/config_gram.l,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- config_gram.l	1 Oct 2002 21:03:46 -0000	1.8
  +++ config_gram.l	12 Nov 2003 22:11:03 -0000	1.9
  @@ -78,6 +78,7 @@
   Spread_Segment                  { return SEGMENT; }
   EventLogFile                    { return EVENTLOGFILE; }
   EventTimeStamp                  { return EVENTTIMESTAMP; }
  +EventPriority                   { return EVENTPRIORITY; }
   DebugFlags                      { return DEBUGFLAGS; }
   DangerousMonitor                { return DANGEROUSMONITOR; }
   SocketPortReuse                 { return SOCKETPORTREUSE; }
  @@ -117,6 +118,12 @@
   M                               { yylval.mask = IFTYPE_MONITOR; return IMONITOR; }
   C                               { yylval.mask = IFTYPE_CLIENT; return ICLIENT; }
   D                               { yylval.mask = IFTYPE_DAEMON; return IDAEMON; }
  +pDEBUG                           { yylval.number = 1; return PDEBUG; }
  +INFO                            { yylval.number = 2; return PINFO; }
  +WARNING                         { yylval.number = 3; return PWARNING; }
  +ERROR                           { yylval.number = 4; return PERROR; }
  +CRITICAL                        { yylval.number = 5; return PCRITICAL; }
  +FATAL                           { yylval.number = 6; return PFATAL; }
   
   {ipport}                        { struct in_addr inaddr;
                                     int a1,a2,a3,a4,a5;
  
  
  
  1.10      +19 -4     spread/daemon/config_parse.y
  
  Index: config_parse.y
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/config_parse.y,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- config_parse.y	24 Oct 2003 21:51:41 -0000	1.9
  +++ config_parse.y	12 Nov 2003 22:11:03 -0000	1.10
  @@ -187,7 +187,8 @@
   
   %}
   %start Config
  -%token SEGMENT EVENTLOGFILE EVENTTIMESTAMP IPADDR NUMBER COLON
  +%token SEGMENT EVENTLOGFILE EVENTTIMESTAMP EVENTPRIORITY IPADDR NUMBER COLON
  +%token PDEBUG PINFO PWARNING PERROR PCRITICAL PFATAL
   %token OPENBRACE CLOSEBRACE EQUALS STRING
   %token DEBUGFLAGS BANG
   %token DDEBUG DEXIT DPRINT DDATA_LINK DNETWORK DPROTOCOL DSESSION
  @@ -242,15 +243,29 @@
   			}
   		|	{ $$.mask = NONE; }
   		;
  +PriorityLevel   :       PDEBUG { $$ = $1; }
  +                |       PINFO { $$ = $1; }
  +                |       PWARNING { $$ = $1; }
  +                |       PERROR { $$ = $1; }
  +                |       PCRITICAL { $$ = $1; }
  +                |       PFATAL { $$ = $1; }
  +                ;
   
   ParamStruct	:	DEBUGFLAGS EQUALS OPENBRACE AlarmBitComp CLOSEBRACE
   			{
   			  if (! Alarm_get_interactive() ) {
  -                            Alarm_clear(ALL);
  -			    Alarm_set($4.mask);
  -			    Alarm(CONF, "Set Alarm mask to: %x\n", Alarm_get());
  +                            Alarm_clear_types(ALL);
  +			    Alarm_set_types($4.mask);
  +			    Alarm(CONF, "Set Alarm mask to: %x\n", Alarm_get_types());
                             }
   			}
  +                |       EVENTPRIORITY EQUALS PriorityLevel
  +                        {
  +                            if (! Alarm_get_interactive() ) {
  +                                Alarm_set_priority($3.number);
  +                            }
  +                        }
  +
   		|	EVENTLOGFILE EQUALS STRING
   			{
   			  if (! Alarm_get_interactive() ) {
  
  
  
  1.9       +3 -3      spread/daemon/monitor.c
  
  Index: monitor.c
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/monitor.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- monitor.c	18 Jun 2003 14:31:23 -0000	1.8
  +++ monitor.c	12 Nov 2003 22:11:03 -0000	1.9
  @@ -98,7 +98,7 @@
   
   	fclose(stderr);
   
  -	Alarm_set( NONE ); 
  +	Alarm_set_types( NONE ); 
   
   	Alarm( PRINT, "/===========================================================================\\\n");
   	Alarm( PRINT, "| The Spread Toolkit.                                                       |\n");
  @@ -146,8 +146,8 @@
   	Cn = Conf();
           My = Conf_my();
   
  -        Alarm_clear(ALL);
  -        Alarm_set(PRINT | EXIT );
  +        Alarm_clear_types(ALL);
  +        Alarm_set_types(PRINT | EXIT );
   
   	for( i=0; i < Conf_num_procs( &Cn ); i++ )
   		Partition[i] = 0;
  
  
  
  1.8       +1 -1      spread/daemon/sp.c
  
  Index: sp.c
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/sp.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- sp.c	18 Jun 2003 14:31:23 -0000	1.7
  +++ sp.c	12 Nov 2003 22:11:03 -0000	1.8
  @@ -359,7 +359,7 @@
   #endif	/* ARCH_PC_WIN95 */
   
   #ifdef ENABLEDEBUG
  -        Alarm_set(SESSION | DEBUG);
  +        Alarm_set_types(SESSION | DEBUG);
   #endif
   
           sp_initialize_locks();
  
  
  
  1.16      +59 -59    spread/daemon/spread.c
  
  Index: spread.c
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/spread.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- spread.c	18 Jun 2003 14:31:23 -0000	1.15
  +++ spread.c	12 Nov 2003 22:11:03 -0000	1.16
  @@ -84,55 +84,55 @@
   	struct passwd *pwd;
   #endif
   
  -	Alarm_set( CONF ); 
  +	Alarm_set_types( CONF ); 
   
  -	Alarm( PRINT, "/===========================================================================\\\n");
  -	Alarm( PRINT, "| The Spread Toolkit.                                                       |\n");
  -	Alarm( PRINT, "| Copyright (c) 1993-2002 Spread Concepts LLC                               |\n"); 
  -	Alarm( PRINT, "| All rights reserved.                                                      |\n");
  -	Alarm( PRINT, "|                                                                           |\n");
  -	Alarm( PRINT, "| The Spread toolkit is licensed under the Spread Open-Source License.      |\n");
  -	Alarm( PRINT, "| You may only use this software in compliance with the License.            |\n");
  -	Alarm( PRINT, "| A copy of the license can be found at http://www.spread.org/license       |\n");
  -        Alarm( PRINT, "|                                                                           |\n");
  -        Alarm( PRINT, "| This product uses software developed by Spread Concepts LLC for use       |\n");
  -        Alarm( PRINT, "| in the Spread toolkit. For more information about Spread,                 |\n");
  -        Alarm( PRINT, "| see http://www.spread.org                                                 |\n");
  -	Alarm( PRINT, "|                                                                           |\n");
  -	Alarm( PRINT, "| This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF     |\n");
  -	Alarm( PRINT, "| ANY KIND, either express or implied.                                      |\n");
  -	Alarm( PRINT, "|                                                                           |\n");
  -	Alarm( PRINT, "| Spread is developed at Spread Concepts LLC and the Center for Networking  |\n");
  - 	Alarm( PRINT, "| and Distributed Systems, The Johns Hopkins University.                    |\n");
  -	Alarm( PRINT, "|                                                                           |\n");
  -	Alarm( PRINT, "| Creators:                                                                 |\n");
  -	Alarm( PRINT, "|    Yair Amir             yairamir at cs.jhu.edu                              |\n");
  -	Alarm( PRINT, "|    Michal Miskin-Amir    michal at spreadconcepts.com                        |\n");
  -	Alarm( PRINT, "|    Jonathan Stanton      jonathan at cs.jhu.edu                              |\n");
  -	Alarm( PRINT, "|                                                                           |\n");
  -	Alarm( PRINT, "| Major Contributors:                                                       |\n");
  -        Alarm( PRINT, "|    Cristina Nita-Rotaru crisn at cnds.jhu.edu - group communication security.|\n");
  -        Alarm( PRINT, "|    Theo Schlossnagle    jesus at omniti.com - Perl, skiplists, autoconf.     |\n");
  -	Alarm( PRINT, "|    Dan Schoenblum       dansch at cnds.jhu.edu - Java interface.             |\n");
  -        Alarm( PRINT, "|    John Schultz         jschultz at d-fusion.net - contribution to process   |\n");
  -        Alarm( PRINT, "|                                       group membership.                   |\n");
  -	Alarm( PRINT, "|                                                                           |\n");
  -	Alarm( PRINT, "| Special thanks to the following for providing ideas and/or code:          |\n");
  -	Alarm( PRINT, "|    Ken Birman, Danny Dolev, Mike Goodrich, Ben Laurie,                    |\n");
  -        Alarm( PRINT, "|    David Shaw, Robbert VanRenesse.                                        |\n");
  -	Alarm( PRINT, "|                                                                           |\n");
  -        Alarm( PRINT, "| Partial funding provided by the Defense Advanced Research Project Agency  |\n");
  -        Alarm( PRINT, "| (DARPA) and the National Security Agency (NSA) since 2000. The Spread     |\n");
  -        Alarm( PRINT, "| toolkit is not necessarily endorsed by DARPA or the NSA.                  |\n");
  -        Alarm( PRINT, "|                                                                           |\n");
  -	Alarm( PRINT, "| For a full list of contributors, see Readme.txt in the distribution.      |\n");
  -	Alarm( PRINT, "|                                                                           |\n");
  -	Alarm( PRINT, "| WWW:     www.spread.org     www.cnds.jhu.edu    www.spreadconcepts.com    |\n");
  -	Alarm( PRINT, "| Contact: spread at spread.org                                                |\n");
  -	Alarm( PRINT, "|                                                                           |\n");
  -	Alarm( PRINT, "| Version %d.%02d.%02d Built 20/June/2003                                        |\n", 
  +	Alarmp( SPLOG_PRINT, SYSTEM, "/===========================================================================\\\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| The Spread Toolkit.                                                       |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| Copyright (c) 1993-2002 Spread Concepts LLC                               |\n"); 
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| All rights reserved.                                                      |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| The Spread toolkit is licensed under the Spread Open-Source License.      |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| You may only use this software in compliance with the License.            |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| A copy of the license can be found at http://www.spread.org/license       |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "| This product uses software developed by Spread Concepts LLC for use       |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "| in the Spread toolkit. For more information about Spread,                 |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "| see http://www.spread.org                                                 |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF     |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| ANY KIND, either express or implied.                                      |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| Spread is developed at Spread Concepts LLC and the Center for Networking  |\n");
  + 	Alarmp( SPLOG_PRINT, SYSTEM, "| and Distributed Systems, The Johns Hopkins University.                    |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| Creators:                                                                 |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|    Yair Amir             yairamir at cs.jhu.edu                              |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|    Michal Miskin-Amir    michal at spreadconcepts.com                        |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|    Jonathan Stanton      jonathan at cs.jhu.edu                              |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| Major Contributors:                                                       |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "|    Cristina Nita-Rotaru crisn at cnds.jhu.edu - group communication security.|\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "|    Theo Schlossnagle    jesus at omniti.com - Perl, skiplists, autoconf.     |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|    Dan Schoenblum       dansch at cnds.jhu.edu - Java interface.             |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "|    John Schultz         jschultz at d-fusion.net - contribution to process   |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "|                                       group membership.                   |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| Special thanks to the following for providing ideas and/or code:          |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|    Ken Birman, Danny Dolev, Mike Goodrich, Ben Laurie,                    |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "|    David Shaw, Robbert VanRenesse.                                        |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "| Partial funding provided by the Defense Advanced Research Project Agency  |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "| (DARPA) and the National Security Agency (NSA) since 2000. The Spread     |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "| toolkit is not necessarily endorsed by DARPA or the NSA.                  |\n");
  +        Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| For a full list of contributors, see Readme.txt in the distribution.      |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| WWW:     www.spread.org     www.cnds.jhu.edu    www.spreadconcepts.com    |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| Contact: spread at spread.org                                                |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "| Version %d.%02d.%02d Built 20/June/2003                                        |\n", 
   		(int)SP_MAJOR_VERSION, (int)SP_MINOR_VERSION, (int)SP_PATCH_VERSION );
  -	Alarm( PRINT, "\\===========================================================================/\n");
  +	Alarmp( SPLOG_PRINT, SYSTEM, "\\===========================================================================/\n");
   
   	Usage( argc, argv );
   
  @@ -140,7 +140,7 @@
   
   	ret = WSAStartup( MAKEWORD(1,1), &WSAData );
   	if( ret != 0 )
  -		Alarm( EXIT, "Spread: winsock initialization error %d\n", ret );
  +            Alarmp( SPLOG_FATAL, NETWORK, "Spread: winsock initialization error %d\n", ret );
   
   #endif	/* ARCH_PC_WIN95 */
   
  @@ -169,7 +169,7 @@
   	/* Yupp, we're paranoid */
    
   	if (geteuid() != (uid_t) 0) {
  -                Alarm( PRINT, "Spread: not running as root, won't chroot\n" );
  +            Alarmp( SPLOG_WARNING, SEC, "Spread: not running as root, won't chroot\n" );
   	}
   	else if ( (grp = getgrnam(Conf_get_group())) == NULL
                     || (pwd = getpwnam(Conf_get_user())) == NULL ) {
  @@ -177,7 +177,7 @@
   	}
   	else if (chdir(Conf_get_runtime_dir()) < 0
                     || chroot(Conf_get_runtime_dir()) < 0 ) {
  -            Alarm( EXIT, "Spread: FAILED chroot to '%s'\n",
  +            Alarmp( SPLOG_FATAL, SEC, "Spread: FAILED chroot to '%s'\n",
                      Conf_get_runtime_dir() );
   	}
   	else if ( setgroups(1, &grp->gr_gid) < 0
  @@ -185,7 +185,7 @@
                     || setuid(pwd->pw_uid) < 0) {
               Invalid_privilege_decrease(Conf_get_user(), Conf_get_group());
   	} else {
  -                Alarm( PRINT, "Spread: setugid and chroot successeful\n" );
  +            Alarmp( SPLOG_INFO, SEC, "Spread: setugid and chroot successeful\n" );
   	}
   
   #endif	/* ARCH_PC_WIN95 */
  @@ -197,18 +197,18 @@
   
   static  void    Print_help(void)
   {
  -        Alarm( EXIT, "Usage: spread\n%s\n%s\n%s\n",
  -               "\t[-l y/n]          : print log",
  -               "\t[-n <proc name>]  : force computer name",
  -               "\t[-c <file name>]  : specify configuration file" );
  +    Alarmp( SPLOG_FATAL, SYSTEM, "Usage: spread\n%s\n%s\n%s\n",
  +           "\t[-l y/n]          : print log",
  +           "\t[-n <proc name>]  : force computer name",
  +           "\t[-c <file name>]  : specify configuration file" );
   }
   
   
   static	void	Invalid_privilege_decrease(char *user, char *group)
   {
  -        Alarm( EXIT, "Spread: FAILED privilege drop to user/group "
  -               "'%s/%s' (defined in spread.conf or spread_params.h)\n",
  -               user, group );
  +    Alarmp( SPLOG_FATAL, SEC, "Spread: FAILED privilege drop to user/group "
  +           "'%s/%s' (defined in spread.conf or spread_params.h)\n",
  +           user, group );
   }
   
   static	void	Usage(int argc, char *argv[])
  @@ -225,7 +225,7 @@
   		{
                           if (argc < 2) Print_help();
   			if( strlen( argv[1] ) > MAX_PROC_NAME-1 ) /* -1 for the null */
  -				Alarm( EXIT, "Usage: proc name %s too long\n",
  +                              Alarmp( SPLOG_FATAL, SYSTEM, "Usage: proc name %s too long\n",
   					argv[1] );
   
   			memcpy( My_name_buf, argv[1], strlen( argv[1] ) );
  
  
  




More information about the Spread-cvs mailing list