New function OPENSSL_issetugid(). Needs more work.

This commit is contained in:
Ulf Möller
2001-02-14 01:35:44 +00:00
parent cdc7b8cc60
commit 36fafffae2
3 changed files with 104 additions and 10 deletions

View File

@@ -196,10 +196,11 @@ err:
const char *RAND_file_name(char *buf, int size)
{
char *s;
char *s=NULL;
char *ret=NULL;
s=getenv("RANDFILE");
if (OPENSSL_issetugid() == 0)
s=getenv("RANDFILE");
if (s != NULL)
{
strncpy(buf,s,size-1);
@@ -208,16 +209,19 @@ const char *RAND_file_name(char *buf, int size)
}
else
{
s=getenv("HOME");
if (s == NULL) return(RFILE);
if (((int)(strlen(s)+strlen(RFILE)+2)) > size)
return(RFILE);
strcpy(buf,s);
if (OPENSSL_issetugid() == 0)
s=getenv("HOME");
if (s != NULL && (strlen(s)+strlen(RFILE)+2 < size))
{
strcpy(buf,s);
#ifndef VMS
strcat(buf,"/");
strcat(buf,"/");
#endif
strcat(buf,RFILE);
ret=buf;
strcat(buf,RFILE);
ret=buf;
}
else
buf[0] = '\0'; /* no file name */
}
return(ret);
}