httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@locus.apache.org
Subject cvs commit: apache-1.3/src/support htpasswd.c
Date Wed, 03 May 2000 17:58:58 GMT
coar        00/05/03 10:58:58

  Modified:    src      CHANGES
               src/support htpasswd.c
  Log:
  	Use our own buffer for tmpnam() if the platform seems to know
  	about it.  Avoids threading and reentrancy problems.
  
  PR:		3945, 5253, 5383, 5558
  
  Revision  Changes    Path
  1.1536    +3 -1      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1535
  retrieving revision 1.1536
  diff -u -u -r1.1535 -r1.1536
  --- CHANGES	2000/05/03 10:33:58	1.1535
  +++ CHANGES	2000/05/03 17:58:56	1.1536
  @@ -1,7 +1,9 @@
   Changes with Apache 1.3.13
   
     *) Add some more error reporting to htpasswd in the case of problems
  -     generating or accessing the temporary file.  [Ken Coar]
  +     generating or accessing the temporary file.  Also, pass in a
  +     buffer if the implementation knows how to use it (i.e., if L_tmpnam
  +     is defined).  [Ken Coar]  PR#3945, 5253, 5383, 5558
   
     *) PORT: Add recognition of the GNU/Hurd platform.
        [Adam Farrell <skate111@stampede.org>]
  
  
  
  1.39      +16 -1     apache-1.3/src/support/htpasswd.c
  
  Index: htpasswd.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/support/htpasswd.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -u -r1.38 -r1.39
  --- htpasswd.c	2000/05/03 10:33:59	1.38
  +++ htpasswd.c	2000/05/03 17:58:57	1.39
  @@ -122,6 +122,14 @@
    * access it.
    */
   static char *tempfilename;
  +/*
  + * If our platform knows about the tmpnam() external buffer size, create
  + * a buffer to pass in.  This is needed in a threaded environment, or
  + * one that thinks it is (like HP-UX).
  + */
  +#ifdef L_tmpnam
  +static char tname_buf[L_tmpnam];
  +#endif
   
   /*
    * Get a line of input from the user, not including any terminating
  @@ -518,11 +526,18 @@
        * We can access the files the right way, and we have a record
        * to add or update.  Let's do it..
        */
  +    errno = 0;
  +#ifdef L_tmpnam
  +    tempfilename = tmpnam(tname_buf);
  +#else   /* def L_tmpnam */
       tempfilename = tmpnam(NULL);
  +#endif  /* def L_tmpnam */
       if ((tempfilename == NULL) || (strlen(tempfilename) == 0)) {
   	fprintf(stderr, "%s: unable to generate temporary filename\n",
   		argv[0]);
  -	errno = ENOENT;
  +	if (errno == 0) {
  +	    errno = ENOENT;
  +	}
   	perror("tmpnam");
   	exit(ERR_FILEPERM);
       }
  
  
  

Mime
View raw message