<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Matt,<br>
    <br>
    First, after some experimentation, I have the following command line
    setup:<br>
    <font color="#3333ff"><br>
      ./configure --disable-zlib --disable-syslog --disable-lastlog
      --disable-shadow --disable-utmp --disable-utmpx --disable-wtmp
      --disable-wtmpx --disable-loginfunc --disable-pututline
      --disable-pututxline<br>
      <br>
      <font color="#330033">Are these options correct for a strictly
        client only build?</font><br>
      <br>
      make PROGRAMS=dbclient &gt;make.log 2&gt;&amp;1<br>
    </font><br>
    However, in "config.h" I still have:<br>
    <font color="#3333ff"><br>
      337 /* Define to 1 if you have the `utmpxname' function. */<br>
      338 #define HAVE_UTMPXNAME 1<br>
      339 <br>
      340 /* Define to 1 if you have the &lt;utmpx.h&gt; header file. */<br>
      341 #define HAVE_UTMPX_H 1<br>
      342 <br>
      343 /* Define to 1 if you have the &lt;utmp.h&gt; header file. */<br>
      344 #define HAVE_UTMP_H 1<br>
      <br>
    </font>Shouldn't these #defines not be there (based on the
    "./configure" command)?<br>
    <br>
    Actually, this is a problem since Xcode is telling me that these
    header files do not exist.<br>
    <br>
    Since I do not want to change anything in config.h, I make changes
    in "options.h".<br>
    <br>
    It looks like "includes.h" has<br>
    <font color="#3333ff"><br>
      #include "config.h"<br>
      #include "options.h" <br>
    </font><br>
    "options.h" is after "config.h" so I should be able to undef what I
    don't need.<br>
    <br>
    Is this the proper procedure?<br>
    <br>
    Currently, my "options.h" has:<br>
    <font color="#3333ff"><br>
/******************************************************************<br>
      &nbsp;* Define compile-time options below - the "#ifndef DROPBEAR_XXX
      .... #endif"<br>
      &nbsp;* parts are to allow for commandline -DDROPBEAR_XXX options etc.<br>
&nbsp;******************************************************************/<br>
      #define TARGET_IPHONE<br>
      <br>
      #if defined(TARGET_IPHONE)<br>
      &nbsp;&nbsp;&nbsp; /* This should be set as part of the "compiler command line
      defines" but we just make sure */<br>
      &nbsp;&nbsp;&nbsp; #if !defined(DROPBEAR_CLIENT)<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #define DROPBEAR_CLIENT<br>
      &nbsp;&nbsp;&nbsp; #endif<br>
      <br>
      &nbsp;&nbsp;&nbsp; /* Define to 1 if you have the `utmpname' function. */<br>
      &nbsp;&nbsp;&nbsp; #if defined(HAVE_UTMPNAME)<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #undef HAVE_UTMPNAME<br>
      &nbsp;&nbsp;&nbsp; #endif<br>
      <br>
      &nbsp;&nbsp;&nbsp; /* Define to 1 if you have the `utmpxname' function. */<br>
      &nbsp;&nbsp;&nbsp; #if defined(HAVE_UTMPXNAME)<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #undef HAVE_UTMPXNAME<br>
      &nbsp;&nbsp;&nbsp; #endif<br>
      <br>
      &nbsp;&nbsp;&nbsp; /* Define to 1 if you have the &lt;utmpx.h&gt; header file. */<br>
      &nbsp;&nbsp;&nbsp; #if defined(HAVE_UTMPX_H)<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #undef HAVE_UTMPX_H<br>
      &nbsp;&nbsp;&nbsp; #endif<br>
      <br>
      &nbsp;&nbsp;&nbsp; /* Define to 1 if you have the &lt;utmp.h&gt; header file. */<br>
      &nbsp;&nbsp;&nbsp; #if defined(HAVE_UTMP_H)<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #undef HAVE_UTMP_H<br>
      &nbsp;&nbsp;&nbsp; #endif<br>
      #endif<br>
      ...<br>
      ...<br>
      ...<br>
    </font><br>
    One more thing. As I find small issues (as shown above) do I go
    ahead and post in the list?<br>
    It could get verbose.<br>
    <br>
    -George<br>
    On 8/25/10 7:40 AM, Matt Johnston wrote:
    <blockquote cite="mid:20100825114011.GF4478@ucc.gu.uwa.edu.au"
      type="cite">
      <pre wrap="">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:
</pre>
      <blockquote type="cite">
        <pre wrap=""> 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: <a class="moz-txt-link-freetext" href="http://www.xm5design.com/">http://www.xm5design.com/</a>

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" &gt;make.log 2&gt;&amp;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.
</pre>
      </blockquote>
      <pre wrap="">
</pre>
    </blockquote>
    <br>
  </body>
</html>