123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- #include "includes.h"
- int dropbear_main(int argc, char ** argv);
- int cli_main(int argc, char ** argv);
- int dropbearkey_main(int argc, char ** argv);
- int dropbearconvert_main(int argc, char ** argv);
- int scp_main(int argc, char ** argv);
- static int runprog(const char *progname, int argc, char ** argv, int *match) {
- *match = DROPBEAR_SUCCESS;
- #ifdef DBMULTI_dropbear
- if (strcmp(progname, "dropbear") == 0) {
- return dropbear_main(argc, argv);
- }
- #endif
- #ifdef DBMULTI_dbclient
- if (strcmp(progname, "dbclient") == 0
- || strcmp(progname, "ssh") == 0) {
- return cli_main(argc, argv);
- }
- #endif
- #ifdef DBMULTI_dropbearkey
- if (strcmp(progname, "dropbearkey") == 0) {
- return dropbearkey_main(argc, argv);
- }
- #endif
- #ifdef DBMULTI_dropbearconvert
- if (strcmp(progname, "dropbearconvert") == 0) {
- return dropbearconvert_main(argc, argv);
- }
- #endif
- #ifdef DBMULTI_scp
- if (strcmp(progname, "scp") == 0) {
- return scp_main(argc, argv);
- }
- #endif
- *match = DROPBEAR_FAILURE;
- return 1;
- }
- int main(int argc, char ** argv) {
- int i;
- for (i = 0; i < 2; i++) {
-
- if (argc > i) {
- int match, res;
-
- const char* progname = basename(argv[i]);
- res = runprog(progname, argc-i, &argv[i], &match);
- if (match == DROPBEAR_SUCCESS) {
- return res;
- }
- }
- }
- fprintf(stderr, "Dropbear SSH multi-purpose v%s\n"
- "Make a symlink pointing at this binary with one of the\n"
- "following names or run 'dropbearmulti <command>'.\n"
- #ifdef DBMULTI_dropbear
- "'dropbear' - the Dropbear server\n"
- #endif
- #ifdef DBMULTI_dbclient
- "'dbclient' or 'ssh' - the Dropbear client\n"
- #endif
- #ifdef DBMULTI_dropbearkey
- "'dropbearkey' - the key generator\n"
- #endif
- #ifdef DBMULTI_dropbearconvert
- "'dropbearconvert' - the key converter\n"
- #endif
- #ifdef DBMULTI_scp
- "'scp' - secure copy\n"
- #endif
- ,
- DROPBEAR_VERSION);
- exit(1);
- }
|