Changeset 838:7e78b8dfd899 in roaraudio for libroar/socket.c


Ignore:
Timestamp:
09/27/08 02:51:36 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

done som preperation for SSH Proxy code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/socket.c

    r837 r838  
    601601 char * user = NULL, * pw = NULL, * opts = NULL; 
    602602 char * sep; 
     603 int    no_fh = 0; 
    603604 static struct passwd * passwd; 
    604605 int (* code)(int mode, int fh, char * host, int port, char * user, char * pw, char * opts) = NULL; 
     
    633634  if ( !strncmp(proxy_addr, "http://", 7) ) 
    634635   proxy_addr += 7; 
     636 } else if ( !strncmp(proxy_type, "ssh", 3) ) { 
     637  proxy_port = 22; 
     638  proxy_addr = getenv("ssh_proxy"); 
     639  no_fh      = 1; 
    635640 } 
    636641 
     
    662667  proxy_port = atoi(&proxy_addr[i+1]); 
    663668 
    664  if ( (fh = roar_socket_open(mode, type, proxy_host, proxy_port)) == -1) { 
    665   return -1; 
     669 if ( ! no_fh ) { 
     670  if ( (fh = roar_socket_open(mode, type, proxy_host, proxy_port)) == -1) { 
     671   return -1; 
     672  } 
    666673 } 
    667674 
     
    679686 
    680687 if ( code != NULL ) { 
    681   if ( code(mode, fh, host, port, user, pw, opts) == -1 ) { 
    682    close(fh); 
    683    return -1; 
     688  if ( no_fh ) { 
     689   fh = code(mode, fh, host, port, user, pw, opts); 
     690  } else { 
     691   if ( code(mode, fh, host, port, user, pw, opts) == -1 ) { 
     692    close(fh); 
     693    return -1; 
     694   } 
    684695  } 
    685696 
Note: See TracChangeset for help on using the changeset viewer.