list management
Kirk Bailey
idiot1 at netzero.net
Wed Dec 11 23:44:56 EST 2002
I just went in on ssh, and tried issuing the newaliases command- regfused by
the server. As su, it works fine. Hate to be the bearer of sad news, but in
FreeBSD you cannot do this.
I wonder why...
Emil Isberg wrote:
> On Wed, 11 Dec 2002, Kirk Bailey wrote:
>
>
>>I want to be able to add and delete email lsits to my email system. This
>>means adding and deleting alias definitions to the aliases file in
>>/etc/mail, and then running the newaliases command. To do this, the web
>>server must run a program, a script. This is exeuted in my freebsd server
>>as nobody. How may I accomplish this task?
>
>
> I don't think sudo is what you are looking for...
> I would set it up as several alias-files from the MTAs point of view and
> then make sure that the right one is writeable by nobody (or a specific
> user for the web-mail-handler-stuff).
>
> Sendmails newaliases is runable by any user (including nobody) so you
> should be able to run it from whatever script there is...
>
> Else you might want to create a setuid application that only does an
> append on a certain file and then calls newaliases.
>
> How about the following? (Some checks on alias and stuff needs to be
> added... Either here or before this program is called.)
>
> #define MAX_LEN 1024
> int main(int argc, char *argv[])
> {
> FILE *fp=NULL;
> int len=0;
> char buf[MAX_LEN+1]="";
>
> if (argc!=3 || !argv[2] || !argv[3])
> {
> printf("Usage: <addalias> <alias> <target>\r\n");
> exit(EXIT_SUCCESS);
> }
>
> len=strlen(argv[1])+strlen(argv[2])+10;
> if (len > MAX_LEN)
> exit(EXIT_FAILURE);
>
> strcpy(buf, argv[1]);
> strcat(buf, ":\t");
> strcat(buf, argv[2]);
> strcat(buf, "\r\n");
>
> if (!(fp=fopen("/etc/mail/mywebaliases", "wt+"))
> exit(EXIT_FAILURE);
>
> fputs(buf, fp);
> fclose(fp);
> /* Make sure that newaliases is in the path. */
> execlp("newaliases", "newaliases", NULL);
> /* If we get here then I failed to find newaliases. */
> puts("Couldn't find and execute newaliases.");
> return 0;
> }
>
--
end
Respectfully,
Kirk D Bailey
+---------------------"Thou Art Free." -Eris-----------------------+
| http://www.howlermonkey.net mailto:highprimate at howlermonkey.net |
| KILL spam dead! http://www.scambusters.org/stopspam/#Pledge |
| http://www.tinylist.org +--------+ mailto:grumpy at tinylist.org |
+------------------Thinking| NORMAL |Thinking----------------------+
+--------+
---------------------------------------------
Introducing NetZero Long Distance
1st month Free!
Sign up today at: www.netzerolongdistance.com
More information about the sudo-users
mailing list