Article delegate-en/964 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]

Newsgroups: mail-lists.delegate-en

[DeleGate-En] Changin user in the POP and IMAP proxy
17 Jan 2001 17:43:07 GMT Christian Couder <pyebqbdyi-znqnbuiqqalr.ml@ml.delegate.org>


Hi,

I made a patch to fill my needs and perhaps it can be usefull to others and/or integrated into DeleGate.

My patch create a new -U config option and use it in the pop.c file to modify the user.

For example if you use the option

-U%s@titi..

and then when you telnet DeleGate's pop port and send

USER toto

then DeleGate will send 

USER toto@titi..

to the pop server.


Though if you send 

USER toto@titi..

to DeleGate, then Delegate will not modify the user, because my patch modify the user only if there is no '@' in it.


The -U option must be followed (without spaces) by something like

prefix%ssuffix and the %s between 'prefix' and 'suffix' will be replaced by the user sent to DeleGate.

I am using SunOS 5.8 and DeleGate 6.1.22.

Regards,
Christian.

															 


diff -cr old_delegate6.1.22/src/delegated.c delegate6.1.22/src/delegated.c
*** old_delegate6.1.22/src/delegated.c  lun d蜒   4 08:02:05 2000
--- delegate6.1.22/src/delegated.c      mer jan  17 16:26:18 2001
***************
*** 823,828 ****
--- 823,831 ----
                        }
                        break;
 
+               /* Ajout Christian : User format */
+               case 'U': pushEnv(P_UFORMAT,val); break;
+
                case 'v':
                        if( arg[2] == 0 ){
                                LOG_type |= L_FG|L_TTY;
diff -cr old_delegate6.1.22/src/param.c delegate6.1.22/src/param.c
*** old_delegate6.1.22/src/param.c      jeu ao赶 31 09:01:07 2000
--- delegate6.1.22/src/param.c  mer jan  17 16:17:48 2001
***************
*** 124,129 ****
--- 124,130 ----
  char P_TUNNEL[]   = "TUNNEL";
  char P_TIMEOUT[]  = "TIMEOUT";
  char P_TRACELOG[] = "TRACELOG";
+ char P_UFORMAT[]  = "UFORMAT";
  char P_UMASK[]    = "UMASK";
  char P_URICONV[]  = "URICONV";
  char P_VARDIR[]   = "VARDIR";                                                 diff -cr old_delegate6.1.22/src/param.h delegate6.1.22/src/param..h
*** old_delegate6.1.22/src/param.h      ven nov  17 07:30:03 2000
--- delegate6.1.22/src/param.h  mer jan  17 16:19:24 2001
***************
*** 126,131 ****
--- 126,132 ----
  extern char P_TUNNEL[];
  extern char P_TIMEOUT[];
  extern char P_TRACELOG[];
+ extern char P_UFORMAT[];
  extern char P_UMASK[];
  extern char P_URICONV[];
  extern char P_VARDIR[];
diff -cr old_delegate6.1.22/src/pop.c delegate6.1.22/src/pop.c
*** old_delegate6.1.22/src/pop.c        mar juin 27 05:02:13 2000
--- delegate6.1.22/src/pop.c    mer jan  17 16:52:44 2001
***************
*** 440,445 ****
--- 440,461 ----
        return 0;
  }
 
+ /* Ajout Christian */
+ static change_user(userbuf, arg)
+       char *userbuf, *arg;
+ {
+       char *uformat;
+       if( strchr(arg,'@') == NULL ) {
+               if(uformat = DELEGATE_getEnv(P_UFORMAT)) {
+                       sv1log("Christian: uformat: %s", uformat);
+                       sprintf(userbuf, uformat, arg);
+                       sv1log("Christian: user: %s", userbuf);
+               }
+       } else {
+               strcpy(userbuf, arg);
+       }
+ }
+                                                                                 static ProxyPOP(Conn)
        Connection *Conn;
  {     char myhost[LNSIZE],banner[LNSIZE];
***************
*** 746,752 ****
--- 762,773 ----
                                closePOPserver(ts,fs); ts = fs = NULL;
                                goto EXIT;
                        }
+
+                       /* Modif Christian
                        strcpy(userbuf,arg);
+                       */
+                       change_user(userbuf,arg);
+
                        user = userbuf;
                        if( timestamp[0] ){
                                fprintf(tc,"+OK enter password for APOP/DeleGate.\r\n");                                                                        


  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V