* Kirill Miazine [2002-10-22 10:02]:
> > I'm trying to write a cgi script for use on my mail server which will call 
> > tmda-address and generate addresses for me.  I don't want to have to login to 
> > my mail server just to run this program.  I'd also like to not have to 
> > remember and type type the entire command line.
> > 
> > However, if my web server runs as user apache, how can I set things up so 
> > that tmda-address can read a user's crypt_key?
> 
> Use a wrapper program, make it setuid your account.
> 
> /*
>  * gcc -Wall -o tmda-addr tmda-addr.c
>  * chmod 4755 tmda-addr
>  */
> 
> #include <stdlib.h>
> #include <stdio.h>
> #include <sys/types.h>
> #include <unistd.h>
> 
> int main(int argc, char *argv[]) {
>     int i, j;
>     char **pargv;
> 
>     fflush(stdout);
> 
>     pargv = (char **)malloc((argc + 5) * sizeof(char *));
> 
>     i = 0;
>     pargv[i++] = "/usr/local/bin/python";
>     pargv[i++] = "/path/to/tmda/bin/tmda-address";
>     pargv[i++] = "-d";
>     for (j = 1; j < argc; j++) {
>         pargv[i++] = argv[j];
>     }
>     pargv[i] = 0;
>     execv ("/usr/local/bin/python", pargv);
> 
>     return 0;
> }

Actually remove the line saying

pargv[i++] = "-d";

This will allow tmda-addr to behave just like tmda-address. I put -d
option there as I was testing with dated address.

-- 
Kirill Miazine, Stud. Jur.          | WARNING:  This message is infected
Faculty of Law, University of Oslo  | with a mutating ~/.signature virus

_____________________________________________
tmda-users mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-users

Reply via email to