Menu

output.cc:406: undefined reference to `nmap_s

Discussion
Frank S.
2003-11-19
2004-09-08
  • Frank S.

    Frank S. - 2003-11-19

    Latest release does not compile. I get an error when trying to link:

    output.cc:406: undefined reference to `nmap_sql_add_port(sql_options*)'

    Frank

     
    • Hasnain Atique

      Hasnain Atique - 2003-11-20

      Frank,

      May I suggest you download the patched sources. The archive is nmap-3.48-with-sql-0.0.2.tar.gz. Once you untar the archive, run ./configure and then a make.

      -- Hasnain

       
    • Hermes

      Hermes - 2003-12-09

      Hi Hasnain

      I had the same issue with the patched sources as Frank described in his post !
      So I downloaded the patch and patched it myself. Patching had one error when I applied the Makefile.patch  "Hunk #1 FAILED at 18." but it did compile well.
      I am not sure if this is a bug. I have posted the nmap scans below (mysql output). Line 3,4 and line 6,8 show filtered ports but the fullversion column has the data from the line above.

      Scan initiated with: nmap -O -sV --mysql xx.xx.xx.xx

      Content portstat table:

      1     2003-12-10 00:08:33 1 xx.xx.xx.xx 21 tcp ftp open   1 1 1
      2     2003-12-10 00:08:33 1 xx.xx.xx.xx 22 tcp ssh open OpenSSH 3.6.1p2 (protocol 2.0) 1 1 2
      3     2003-12-10 00:08:33 1 xx.xx.xx.xx 23 tcp telnet filtered OpenSSH 3.6.1p2 (protocol 2.0) 1 1 3
      4     2003-12-10 00:08:33 1 xx.xx.xx.xx 4444 tcp krb524 filtered OpenSSH 3.6.1p2 (protocol 2.0) 1 1 4
      5     2003-12-10 00:23:57 2 xx.xx.xx.xx 22 tcp ssh open OpenSSH 3.6.1p2 (protocol 2.0) 1 2 5
      6     2003-12-10 00:23:57 2 xx.xx.xx.xx 23 tcp telnet filtered OpenSSH 3.6.1p2 (protocol 2.0) 1 2 6
      7     2003-12-10 00:23:57 2 xx.xx.xx.xx 443 tcp http open Apache httpd 1.3.27 (Ben-SSL/1.48 (Unix) Debian GN... 1 2 7
      8     2003-12-10 00:23:57 2 xx.xx.xx.xx 4444 tcp krb524 filtered Apache httpd 1.3.27 (Ben-SSL/1.48 (Unix) Debian GN... 1 2 8

       
    • Hasnain Atique

      Hasnain Atique - 2003-12-10

      Hello Hermes,

      Are you able to share the output of nmap for this run?

      This is not a planned feature, so it must be a bug ;)

      output.cc line 398-399 is where the fullversion info is captured. These lines are:

      if ( sd.fullversion[0] != 0x00)
                    strcpy( sql.target.ports.fullversion, sd.fullversion);

      where sd.fulversion is what nmap provides. I originally chose not to touch any of Fyodor's code, except for the whole-line inserts for my own code. One of the things I've noticed is nmap's source reuses variables through loop iterations without re-initializing through each iteration. Thus, the value found in a previous iteration remains there until a new value is found. This fools my check in line 398.

      Can you please insert the following:
         sd.fullversion[0] = 0x00;

      after the
         if ( current->state != istate)
      at line 334 in output.cc and see that makes a difference.

      Meanwhile, I'll see if that has any other impact. If none, I'll put up a new .tgz for download.

      Thanks for bringing this to my attention.

      -- Hasnain

       
    • Hermes

      Hermes - 2003-12-11

      Hi Hasnain

      I did as you suggested but the output looks still as before. Don't know if I did it right, was in a hurry. Maybe you wanne have a test yourself.

      Regards

      Hermes

      Here is the nmap output you asked for:
      # nmapsql -O -sV --mysql xx.xx.xx.xx
      Starting nmap 3.48 ( http://www.insecure.org/nmap/ ) at 2003-12-11 22:48 CET
      Interesting ports on dd.dd.dd (xx.xx.xx.xx):
      (The 1653 ports scanned but not shown below are in state: closed)
      PORT     STATE    SERVICE VERSION
      21/tcp   open     ftp?
      22/tcp   open     ssh     OpenSSH 3.6.1p2 (protocol 2.0)
      23/tcp   filtered telnet
      4444/tcp filtered krb524
      1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :
      SF-Port21-TCP:<FINGERPRINT>
      Device type: general purpose
      Running: Linux 2.4.X|2.5.X
      OS details: Linux Kernel 2.4.0 - 2.5.20
      Uptime 5.837 days (since Sat Dec  6 02:49:43 2003)
      Nmap run completed -- 1 IP address (1 host up) scanned in 321.498 seconds

      # nmapsql -O -sV --mysql xx.xx.xx.yy
      Starting nmap 3.48 ( http://www.insecure.org/nmap/ ) at 2003-12-11 22:56 CET
      Interesting ports on dd.dd.dd (xx.xx.xx.yy):
      (The 1653 ports scanned but not shown below are in state: closed)
      PORT     STATE    SERVICE  VERSION
      22/tcp   open     ssh      OpenSSH 3.6.1p2 (protocol 2.0)
      23/tcp   filtered telnet
      443/tcp  open     ssl/http Apache httpd 1.3.27 (Ben-SSL/1.48 (Unix) Debian GNU/Linux PHP/4.1.2)
      4444/tcp filtered krb524
      Device type: general purpose
      Running: Linux 2.4.X|2.5.X
      OS details: Linux Kernel 2.4.0 - 2.5.20
      Uptime 55.453 days (since Fri Oct 17 13:08:15 2003)

      Nmap run completed -- 1 IP address (1 host up) scanned in 235.443 seconds

       
    • Hasnain Atique

      Hasnain Atique - 2003-12-12

      Hermes,

      I've fixed the issue, and have uploaded the new source as nmap-3.48-with-sql-0.0.3.tar.gz.

      Let me know if you have any other problems.

      -- Hasnain

       
    • Hasnain Atique

      Hasnain Atique - 2003-12-12

      If you want to take a shortcut, you can just use the output.cc from the new package (either the full .tar.gz, or the patches .tar.gz will do) and recompile.

       
    • Benjamin Krein

      Benjamin Krein - 2004-09-07

      output.o(.text+0x2914): In function `printportoutput(Target*, PortList*)':
      /home/bkrein/nmapsql/nmap-3.48/output.cc:407: undefined reference to `nmap_sql_add_port(sql_options*)'
      collect2: ld returned 1 exit status
      make: *** [nmap] Error 1

      As you can see, I too get these errors.  I'm using the 0.0.3 (including nmap sources) source package and trying to compile on a SuSE 9.1 system with (I believe) all required devel packages installed.

      Benjamin Krein

       
    • Henry B. Tindall, Jr.

      I had the same problem initially; my MySQL libraries were not in the standard "/usr/lib/mysql", as in the stock Makefile.  I had to change the line to:
      LDFLAGS = -Llibpcap-possiblymodified  -Lnbase -Lnsock/src/ $(STATIC) -L/usr/local/lib/mysql -lmysqlclient -lz
      and then it compiled cleanly.

       
    • Chad

      Chad - 2004-09-08

      Ive tried both with the nmap-3.48-nmap-sql-0.3 package and with getting the nmap-3.48 sources from insecure.org and the patches from this site.   using the source and patch from sourceforge, i get the exact same error as mentioned by Frank and Benjamin.  Using the sources from insecure.org and the patch from sourceforge i get
      nmap-sql.cc: In function `long unsigned int nmap_sql_add_runid(sql_options*)':
      nmap-sql.cc:81: error: 'struct run_info' has no member named 'type'
      nmap-sql.cc: In function `unsigned int nmap_sql_add_userid(sql_options*)':
      nmap-sql.cc:189: error: `ABORT_USER' undeclared (first use this function)
      nmap-sql.cc:189: error: (Each undeclared identifier is reported only once for
         each function it appears in.)
      nmap-sql.cc:190: error: 'struct flags_info' has no member named 'user_added'
      nmap-sql.cc:193: error: 'struct flags_info' has no member named 'custom_user_id
         '
      nmap-sql.cc:195: error: `nmap_sql_max_userid' undeclared (first use this
         function)
      nmap-sql.cc:198: error: 'struct cmd_ids' has no member named 'user_id'
      nmap-sql.cc:205: error: `TBL_USERS' undeclared (first use this function)
      nmap-sql.cc:206: error: 'struct sql_access' has no member named 'fullname'
      nmap-sql.cc:210: error: 'struct flags_info' has no member named 'user_added'
      nmap-sql.cc: In function `long unsigned int
         nmap_sql_validate_userid(sql_options*)':
      nmap-sql.cc:269: error: `nmap_sql_get_userid' undeclared (first use this
         function)
      nmap-sql.cc: In function `long unsigned int nmap_sql_get_userid(sql_options*,
         char*)':
      nmap-sql.cc:512: error: `long unsigned int nmap_sql_get_userid(sql_options*,
         char*)' used prior to declaration
      nmap-sql.cc: In function `long unsigned int nmap_sql_max_userid(sql_options*,
         unsigned int)':
      nmap-sql.cc:593: error: `long unsigned int nmap_sql_max_userid(sql_options*,
         unsigned int)' used prior to declaration
      nmap-sql.cc: In function `void nmap_sql_initialize(sql_options*)':
      nmap-sql.cc:680: error: 'struct sql_access' has no member named 'fullname'
      nmap-sql.cc:738: error: 'struct run_info' has no member named 'type'
      nmap-sql.cc:738: error: `RUNTYPE_NMAP' undeclared (first use this function)
      make: *** [nmap-sql.o] Error 1

      either way, it doesnt work. 

      this is on a suse 9.0 system, gcc 3.3.1, mysql 4.0.  ive compiled lots of otehr things on this system with no problems.

       
    • Henry B. Tindall, Jr.

      I used the sources for 3.48 from the download page, but I still had to change the Makefile in some places, according to the README.sql. 
      I got it to compile, but now it doesn't appear to read the nmapsql.rc file mentioned in this month's Linux Journal article...  it always tries to connect to localhost, using /tmp/mysql.sock. 
      I've tried to grep for nmapsql.rc in all the source, but got nothing.
      Anybody else have this problem ??

       

Log in to post a comment.

MongoDB Logo MongoDB