~ubuntu-branches/ubuntu/precise/dropbear/precise

« back to all changes in this revision

Viewing changes to cli-runopts.c

  • Committer: Bazaar Package Importer
  • Author(s): Gerrit Pape
  • Date: 2007-03-02 20:48:18 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070302204818-ozmbou2sbyj7dus5
Tags: 0.49-1
* new upstream release, fixes
  * CVE-2007-1099: dropbear dbclient insufficient warning on hostkey
    mismatch (closes: #412899).
  * dbclient uses static "Password:" prompt instead of using the server's
    prompt (closes: #394996).
* debian/control: Suggests: openssh-client, not ssh (closes: #405686);
  Standards-Version: 3.7.2.2.
* debian/README.Debian: ssh -> openssh-server, openssh-client; remove
  'Replacing OpenSSH "sshd" with Dropbear' part, this is simply done by not
  installing the openssh-server package.
* debian/README.runit: runsvstat -> sv status.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
static void printhelp() {
45
45
 
46
46
        fprintf(stderr, "Dropbear client v%s\n"
47
 
                                        "Usage: %s [options] [user@]host\n"
 
47
                                        "Usage: %s [options] [user@]host [command]\n"
48
48
                                        "Options are:\n"
49
49
                                        "-p <remoteport>\n"
50
50
                                        "-l <username>\n"
51
51
                                        "-t    Allocate a pty\n"
52
52
                                        "-T    Don't allocate a pty\n"
 
53
                                        "-N    Don't run a remote command\n"
 
54
                                        "-f    Run in background after auth\n"
 
55
                                        "-y    Always accept remote host key if unknown\n"
53
56
#ifdef ENABLE_CLI_PUBKEY_AUTH
54
57
                                        "-i <identityfile>   (multiple allowed)\n"
55
58
#endif
88
91
        cli_opts.remoteport = NULL;
89
92
        cli_opts.username = NULL;
90
93
        cli_opts.cmd = NULL;
 
94
        cli_opts.no_cmd = 0;
 
95
        cli_opts.backgrounded = 0;
91
96
        cli_opts.wantpty = 9; /* 9 means "it hasn't been touched", gets set later */
 
97
        cli_opts.always_accept_key = 0;
92
98
#ifdef ENABLE_CLI_PUBKEY_AUTH
93
99
        cli_opts.privkeys = NULL;
94
100
#endif
144
150
                        /* A flag *waves* */
145
151
 
146
152
                        switch (argv[i][1]) {
 
153
                                case 'y': /* always accept the remote hostkey */
 
154
                                        cli_opts.always_accept_key = 1;
 
155
                                        break;
147
156
                                case 'p': /* remoteport */
148
157
                                        next = &cli_opts.remoteport;
149
158
                                        break;
163
172
                                case 'T': /* don't want a pty */
164
173
                                        cli_opts.wantpty = 0;
165
174
                                        break;
 
175
                                case 'N':
 
176
                                        cli_opts.no_cmd = 1;
 
177
                                        break;
 
178
                                case 'f':
 
179
                                        cli_opts.backgrounded = 1;
 
180
                                        break;
166
181
#ifdef ENABLE_CLI_LOCALTCPFWD
167
182
                                case 'L':
168
183
                                        nextislocal = 1;
269
284
                        cli_opts.wantpty = 0;
270
285
                }
271
286
        }
 
287
 
 
288
        if (cli_opts.backgrounded && cli_opts.cmd == NULL
 
289
                        && cli_opts.no_cmd == 0) {
 
290
                dropbear_exit("command required for -f");
 
291
        }
272
292
}
273
293
 
274
294
#ifdef ENABLE_CLI_PUBKEY_AUTH
348
368
 
349
369
        TRACE(("enter addforward"))
350
370
 
351
 
        /* We probably don't want to be editing argvs */
 
371
        /* We need to split the original argument up. This var
 
372
           is never free()d. */ 
352
373
        str = m_strdup(origstr);
353
374
 
354
375
        listenport = str;
358
379
                TRACE(("connectaddr == NULL"))
359
380
                goto fail;
360
381
        }
361
 
 
362
 
        connectaddr[0] = '\0';
 
382
        *connectaddr = '\0';
363
383
        connectaddr++;
364
384
 
365
385
        connectport = strchr(connectaddr, ':');
367
387
                TRACE(("connectport == NULL"))
368
388
                goto fail;
369
389
        }
370
 
 
371
 
        connectport[0] = '\0';
 
390
        *connectport = '\0';
372
391
        connectport++;
373
392
 
374
393
        newfwd = (struct TCPFwdList*)m_malloc(sizeof(struct TCPFwdList));