Matt,
First, after some experimentation, I have the following command line setup:
./configure --disable-zlib --disable-syslog --disable-lastlog --disable-shadow
--disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx
--disable-loginfunc --disable-pututline --disable-pututxline
Are these options correct for a strictly client only build?
make PROGRAMS=dbclient >make.log 2>&1
However, in "config.h" I still have:
337 /* Define to 1 if you have the `utmpxname' function. */
338 #define HAVE_UTMPXNAME 1
339
340 /* Define to 1 if you have the <utmpx.h> header file. */
341 #define HAVE_UTMPX_H 1
342
343 /* Define to 1 if you have the <utmp.h> header file. */
344 #define HAVE_UTMP_H 1
Shouldn't these #defines not be there (based on the "./configure" command)?
Actually, this is a problem since Xcode is telling me that these header files
do not exist.
Since I do not want to change anything in config.h, I make changes in
"options.h".
It looks like "includes.h" has
#include "config.h"
#include "options.h"
"options.h" is after "config.h" so I should be able to undef what I don't need.
Is this the proper procedure?
Currently, my "options.h" has:
/******************************************************************
* Define compile-time options below - the "#ifndef DROPBEAR_XXX .... #endif"
* parts are to allow for commandline -DDROPBEAR_XXX options etc.
******************************************************************/
#define TARGET_IPHONE
#if defined(TARGET_IPHONE)
/* This should be set as part of the "compiler command line defines" but we
just make sure */
#if !defined(DROPBEAR_CLIENT)
#define DROPBEAR_CLIENT
#endif
/* Define to 1 if you have the `utmpname' function. */
#if defined(HAVE_UTMPNAME)
#undef HAVE_UTMPNAME
#endif
/* Define to 1 if you have the `utmpxname' function. */
#if defined(HAVE_UTMPXNAME)
#undef HAVE_UTMPXNAME
#endif
/* Define to 1 if you have the <utmpx.h> header file. */
#if defined(HAVE_UTMPX_H)
#undef HAVE_UTMPX_H
#endif
/* Define to 1 if you have the <utmp.h> header file. */
#if defined(HAVE_UTMP_H)
#undef HAVE_UTMP_H
#endif
#endif
...
...
...
One more thing. As I find small issues (as shown above) do I go ahead and post
in the list?
It could get verbose.
-George
On 8/25/10 7:40 AM, Matt Johnston wrote:
The "multi" stuff is defined in the Makefile - compile with
"make MULTI=1" to create the multi-function binary. If
you're only using dbclient it might be easier to just rename
main() in cli-main.c .
libtomcrypt and libtommath are built as static libraries
that are linked to Dropbear. I think you should be able to
run ./configure once, then add all the files including the
"config.h" to your xcode project. I did that one time a few
years ago and it worked OK, though I'm not sure how you'd
run ./configure with the iphone SDK - perhaps point it at
the relevant cross-compiling $CC?
Off the top of my head I think most of dbclient should be
threadsafe at least if there's only a single instance
running, though there are calls to getpwnam() etc that
could need attention. I guess you could replace the
stdin/stdout file descriptor with a unix pipe to your main
program as a way of talking to your UI with minimal changes
to the dropbear code. You will also need to change the code
in cli-chansession.c that sets up terminal control codes.
Cheers,
Matt
On Tue, Aug 24, 2010 at 09:06:36PM -0400, xaos wrote:
Hello everyone. This is what I'd like to do:
In my iPhone app, I'd like to call the Dropbear client code in order to create
an SSH tunnel
to another machine. I do not want an independent ssh command-line client.
I will be running the client code from an iPhone thread.
I do not want X11 forwarding or SSH compression.
Easier said than done. I guess.
Quick info about myself: I am a serious developer who knows a few things about
iPhone,
Objective-C, C programming and UNIX. Been with UNIX since '84. Yes, I'm,
old(er).
So, I don't need hand holding here, just a few pointers to get me going.
Naturally, I will post
my results as I tend to do, see my blog at: http://www.xm5design.com/
Ok. So my initial code inspection turned out the following:
in "cli-main.c" there is a way to start the code without a "main()" which would
clash with the
"main()" in any iPhone app.
This is good!
However, the defines: "DBMULTI_dbclient" and "DROPBEAR_MULTI" are not
exactly clear on their meaning.
There is a "cli_dropbear_exit" function that seems to be the central exit gate
for the client code.
If true, this is fantastic since I don't want to Dropbear code to "exit()". I want a nice
"return()"
which will shutdown the dropbear thread gracefully (or re-start).
Problem: I can't really use the Makefile genned by configure since I will
execute the code
from Xcode. Any hints?
I tried a simple test on my OSX machine like this:
./configure --disable-zlib --disable-syslog --disable-lastlog
and then:
make PROGRAMS="dbclient">make.log 2>&1
and I got a working client binary. I was able to ssh to another machine, etc,
etc..
However when I do: "otool -L dbclient" (otool is like like ldd)
I only see "/usr/lib/libSystem.B.dylib" no other lib. Does that mean
I don't need the libraries in "libtomcrypt" and "libtommath" for a simple
client code?
Please accept my thanks ahead of time for this. Any help is appreciated.
-George H.