Subject: | add UID to socketname |
Hello,
I've attached a small patch to add the user's effective UID to the socket name used by PPerl. This will make it create a new socket for each user. I added this because I wanted to be run my spamassasin script for several users. However with --anyuser on, $> and $< are always set to the first user who spawned the process. Without --anyuser, only one person can run the script.
I hope you find this useful.
Thanks for PPerl,
--simonflk
--- main.c.orig Sun Nov 17 21:04:05 2002
+++ main.c Sat Feb 28 20:27:35 2004
@@ -225,4 +225,7 @@
int i = 0;
+ char euid[12];
+ sprintf(euid, "_%d", geteuid());
+
if (realpath(scriptname, fullpath) == NULL) {
perror("pperl: resolving full pathname to script failed");
@@ -231,5 +234,5 @@
Dx(Debug("realpath returned: %s\n", fullpath));
/* Ugh. I am a terrible C programmer! */
- sockname = my_malloc(strlen(P_tmpdir) + strlen(fullpath) + 3);
+ sockname = my_malloc(strlen(P_tmpdir) + strlen(fullpath) + 3 + strlen(euid));
save = sockname;
sprintf(sockname, "%s/", P_tmpdir);
@@ -247,5 +250,5 @@
sockname++; i++;
}
- *sockname = '\0';
+ strcat(sockname, euid);
free(fullpath);
return save;