Subject: bin/37: at lock file created with random modes
To: None <gnats-admin>
From: None <thomas@mathematik.uni-Bremen.de>
List: netbsd-bugs
Date: 12/05/1993 15:05:05
>Number:         37
>Category:       bin
>Synopsis:       at lock file created with random modes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec  5 15:05:04 1993
>Originator:     Thomas Eberhardt
>Organization:
CeVis, University of Bremen, Germany
>Release:        
>Environment:
    	
System: NetBSD ed209 0.9a ED209#0 i386

Machine: i386
>Description:
	The lock file for at is created with random modes because of a
	missing argument to open.  Also IMHO the lock structure for
	the fcntl F_SETLKW call should not be left uninitialized.
>How-To-Repeat:
	
>Fix:
*** at.c-	Sun Dec  5 12:36:38 1993
--- at.c	Sun Dec  5 23:53:49 1993
***************
*** 184,190 ****
  
  	PRIV_START
  
! 	    if ((lockdes = open(_PATH_LOCKFILE, O_WRONLY | O_CREAT)) < 0)
  		perr2("Cannot open lockfile ", _PATH_LOCKFILE);
  
  	act.sa_handler = alarmc;
--- 184,190 ----
  
  	PRIV_START
  
! 	    if ((lockdes = open(_PATH_LOCKFILE, O_WRONLY | O_CREAT, 0600)) < 0)
  		perr2("Cannot open lockfile ", _PATH_LOCKFILE);
  
  	act.sa_handler = alarmc;
***************
*** 197,202 ****
--- 197,206 ----
  	 */
  	sigaction(SIGALRM, &act, NULL);
  	alarm(ALARMC);
+ 	lock.l_type = F_WRLCK;
+ 	lock.l_whence = SEEK_SET;
+ 	lock.l_start = 0;
+ 	lock.l_len = 0;
  	fcntl(lockdes, F_SETLKW, &lock);
  	alarm(0);
  
>Audit-Trail:
>Unformatted:

------------------------------------------------------------------------------