~ubuntu-branches/ubuntu/quantal/connect-proxy/quantal

« back to all changes in this revision

Viewing changes to connect.c

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2009-12-11 12:36:01 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20091211123601-zaj6hrc9l9q1jlk1
Tags: 1.101-1
* New upstream release (rebuilt tarball)
* debian/rules :  migrated to quilt
* debian/control : bump standards
* debian/* : updadated maintainer email, and upstream url
* fixed man page

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 * PROJECT:  My Test Program
23
23
 * AUTHOR:   Shun-ichi GOTO <gotoh@taiyo.co.jp>
24
24
 * CREATE:   Wed Jun 21, 2000
25
 
 * REVISION: $Revision: 100 $
26
25
 * ---------------------------------------------------------
27
26
 *
28
27
 * Getting Source
251
250
 
252
251
 
253
252
 
254
 
#ifndef LINT
255
 
static char *vcid = "$Id: connect.c 100 2007-07-03 10:48:26Z gotoh $";
256
 
#endif
257
 
 
258
253
/* Microsoft Visual C/C++ has _snprintf() and _vsnprintf() */
259
254
#ifdef _MSC_VER
260
255
#define snprintf _snprintf
290
285
/* name of this program */
291
286
char *progname = NULL;
292
287
char *progdesc = "connect --- simple relaying command via proxy.";
293
 
char *rcs_revstr = "$Revision: 100 $";
294
 
char *revstr = NULL;
295
 
int major_version = 1;
296
 
int minor_version = 0;
 
288
char *version = "1.101";
297
289
 
298
290
/* set of character for strspn() */
299
291
const char *digits    = "0123456789";
1465
1457
    return (u_short)port;
1466
1458
}
1467
1459
 
1468
 
void
1469
 
make_revstr(void)
1470
 
{
1471
 
    char *ptr;
1472
 
    size_t len;
1473
 
    ptr = strstr(rcs_revstr, ": ");
1474
 
    if (!ptr) {
1475
 
        revstr = strdup("unknown");
1476
 
        return;
1477
 
    }
1478
 
    ptr += 2;
1479
 
    /* assume subversion's keyword expansion like "Revision: 96". */
1480
 
    minor_version = atoi(ptr);
1481
 
    revstr = xmalloc(20);
1482
 
    snprintf(revstr, 20, "%d.%d", major_version, minor_version);
1483
 
}
1484
 
 
1485
1460
int
1486
1461
getarg( int argc, char **argv )
1487
1462
{
1609
1584
                break;
1610
1585
 
1611
1586
            case 'V':                           /* print version */
1612
 
                fprintf(stderr, "%s\nVersion %s\n", progdesc, revstr);
 
1587
                fprintf(stderr, "%s\nVersion %s\n", progdesc, version);
1613
1588
                exit(0);
1614
1589
 
1615
1590
            case 'd':                           /* debug mode */
1633
1608
 
1634
1609
    /* check destination HOST (MUST) */
1635
1610
    if ( argc == 0  ) {
1636
 
        fprintf(stderr, "%s\nVersion %s\n", progdesc, revstr);
 
1611
        fprintf(stderr, "%s\nVersion %s\n", progdesc, version);
1637
1612
        fprintf(stderr, usage, progname);
1638
1613
        exit(0);
1639
1614
    }
1988
1963
        char *askpass = getparam(ENV_SSH_ASKPASS), *cmd;
1989
1964
        int cmd_size = strlen(askpass) +1 +1 +strlen(buf) +1 +1;
1990
1965
        cmd = xmalloc(cmd_size);
 
1966
#if defined(_WIN32) && !defined(__CYGWIN32__)
 
1967
        {
 
1968
            /* Normalize path string of command ('/' => '\\').  This is
 
1969
               required for the case of env value is for the cygwin ssh
 
1970
               because cmd.exe treats '/' as option character.
 
1971
               Note that this does not resolve mounts on cygwin.
 
1972
            */
 
1973
            char *p= askpass;
 
1974
            while (*p) {
 
1975
                if (*p == '/')
 
1976
                    *p = '\\';
 
1977
                p++;
 
1978
            }
 
1979
        }
 
1980
#endif  /* _WIN32 && not __CYGWIN32__ */
1991
1981
        snprintf(cmd, cmd_size, "%s \"%s\"", askpass, buf);
 
1982
        debug("executing: %s", cmd);
1992
1983
        fp = popen(cmd, "r");
1993
1984
        free(cmd);
1994
1985
        if ( fp == NULL )
2861
2852
#endif /* _WIN32 */
2862
2853
 
2863
2854
    /* initialization */
2864
 
    make_revstr();
2865
2855
    getarg( argc, argv );
2866
 
    debug("Program is $Revision: 100 $\n");
2867
2856
 
2868
2857
    /* Open local_in and local_out if forwarding a port */
2869
2858
    if ( local_type == LOCAL_SOCKET ) {