[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freetds
Subject:    Re: [freetds] Host process hard coded to 37876 for Sybase
From:       Frediano Ziglio <freddy77 () gmail ! com>
Date:       2009-08-17 16:53:43
Message-ID: 1250528023.5119.0.camel () freddy
[Download RAW message or body]

Il giorno mer, 05/08/2009 alle 00.50 -0400, Wood, David ha scritto:
> Hello,
> 
>  
> 
> It seems host process is currently hard coded to 37876 if using TDS <= 5
> (eg Sybase):
> 
> % grep 37876 src/tds/login.c
> 
>         tds_put_login_string(tds, "37876", TDS_MAX_LOGIN_STR_SZ);
> /* host process */
> 
>  
> 
> % tsql -Ufoo -SSYB1 -Pbar
> 
> ...
> 
> 1> select hostprocess from sysprocesses where spid = @@spid
> 
> 2> go
> 
> hostprocess
> 
> 37876
> 
> ^Z
> 
>  
> 
> % ps -ef | grep tsql | grep -v grep
> 
>    woodd  2990  2832   0 00:38:09 pts/140     0:00 tsql -Ufoo -SSYB1
> -Pbar
> 
>  
> 
> After applying the patch below:
> 
>  
> 
> % tsql -Ufoo -SSYB1 -Pbar
> 
> ...
> 
> 1> select hostprocess from sysprocesses where spid = @@spid
> 
> 2> go
> 
> hostprocess
> 
> 23294 
> 
> ^Z
> 
>  
> 
> % ps -ef | grep tsql | grep -v grep
> 
>    woodd 23294 23233   0 00:41:47 pts/17      0:00 tsql -Ufoo -SSYB1
> -Pbar
> 
>  
> 
> Context diff against CVS:
> 
>  
> 
> *** login.c     Wed Aug  5 00:45:23 2009
> 
> --- login_patched.c     Wed Aug  5 00:44:22 2009
> 
> ***************
> 
> *** 29,34 ****
> 
> --- 29,38 ----
> 
>   #include <stdlib.h>
> 
>   #endif /* HAVE_STDLIB_H */
> 
>  
> 
> + #ifdef HAVE_LIMITS_H
> 
> + #include <limits.h>
> 
> + #endif /* HAVE_LIMITS_H */
> 
> +
> 
>   #include <assert.h>
> 
>  
> 
>   #if HAVE_STRING_H
> 
> ***************
> 
> *** 593,599 ****
> 
>         tds_put_login_string(tds,
> tds_dstr_cstr(&connection->client_host_name), TDS_MAX_LOGIN_STR_SZ);  /*
> client host name */
> 
>         tds_put_login_string(tds, tds_dstr_cstr(&connection->user_name),
> TDS_MAX_LOGIN_STR_SZ); /* account name */
> 
>         tds_put_login_string(tds, tds_dstr_cstr(&connection->password),
> TDS_MAX_LOGIN_STR_SZ);  /* account password */
> 
> !       tds_put_login_string(tds, "37876", TDS_MAX_LOGIN_STR_SZ);
> /* host process */
> 
>   #ifdef WORDS_BIGENDIAN
> 
>         if (tds->emul_little_endian) {
> 
>                 tds_put_n(tds, le1, 6);
> 
> --- 597,605 ----
> 
>         tds_put_login_string(tds,
> tds_dstr_cstr(&connection->client_host_name), TDS_MAX_LOGIN_STR_SZ);  /*
> client host name */
> 
>         tds_put_login_string(tds, tds_dstr_cstr(&connection->user_name),
> TDS_MAX_LOGIN_STR_SZ); /* account name */
> 
>         tds_put_login_string(tds, tds_dstr_cstr(&connection->password),
> TDS_MAX_LOGIN_STR_SZ);  /* account password */
> 
> !       char pbuf[PID_MAX+1];
> 
> !       sprintf(pbuf, "%d", (int) getpid());
> 
> !       tds_put_login_string(tds, pbuf, TDS_MAX_LOGIN_STR_SZ);  /* host
> process */
> 
>   #ifdef WORDS_BIGENDIAN
> 
>         if (tds->emul_little_endian) {
> 
>                 tds_put_n(tds, le1, 6);
> 
>  
> 
> David
> 

Applied on CVS HEAD, I only reused a buffer.

Thanks
  Frediano


_______________________________________________
FreeTDS mailing list
FreeTDS@lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic