All pastes #284901 Raw Edit

Anonymous

public text v1 · immutable
#284901 ·published 2006-12-19 12:14 UTC
rendered paste body
# svn update
At revision 5.
# cd src
# svn diff -r 4:5 s_auth.c > s_auth.c.diff
#

Index: s_auth.c
===================================================================
--- s_auth.c	(revision 4)
+++ s_auth.c	(revision 5)
@@ -261,11 +261,15 @@
 {
 char authbuf[64];
 char ruser[12],system[8];
+char sremp[8],slocp[8];
 int len;
 u_short remp=0,locp=0;
 
 *system=0;
 *ruser=0;
+*sremp=0;
+*slocp=0;
+
 Debug((DEBUG_NOTICE,"read_authports(%x) fd %d authfd %d stat %d",cptr,cptr->fd,cptr->authfd,cptr->status));
 /*
  * Nasty.  Cant allow any other reads from client fd while we're
@@ -284,17 +288,23 @@
 if((len=recv(cptr->authfd,authbuf,63,0))>=0)
 #endif
   {
+  char *p;
+
   authbuf[len]=0;
+  if((p=index(authbuf,13)) || (p=index(authbuf,10)))
+    *p=0;
   }
 
 cptr->lasttime=time(NULL);
-if((len>0) && sscanf(authbuf,"%hd , %hd : USERID : %7s : %11s",&remp,&locp,system,ruser)==4)
+if((len>0) && strscan(authbuf,"%5 , %5 : USERID : %7 : %11",sremp,slocp,system,ruser)==4)
   {
   Debug((DEBUG_INFO,"auth reply ok [%s] [%s]",system,ruser));
+  remp=atoi(sremp);
+  locp=atoi(slocp);
   }
 else if(len!=0)
   {
-  Debug((DEBUG_ERROR,"local %d remote %d",locp,remp));
+  Debug((DEBUG_ERROR,"local %s remote %s",slocp,sremp));
   Debug((DEBUG_ERROR,"bad auth reply in [%s]",authbuf));
   *ruser=0;
   }