$OpenBSD: patch-sqlsamdump_c,v 1.3 2003/06/03 01:26:50 margarida Exp $
--- sqlsamdump.c.orig	Mon Dec  3 18:08:30 2001
+++ sqlsamdump.c	Tue Jun  3 01:45:09 2003
@@ -22,7 +22,6 @@
 #include "sqllib.h"
 #include "util.h"
 #include "constants.h"
-#include <getopt.h>
 
 /*
   Set a few default values
@@ -71,6 +70,8 @@ int hackSQLServer(struct args_struct arg
   int i, nDirCount = 4;
   TDSLOGIN *login;
   TDSSOCKET *tds;
+  TDSCONTEXT *context = NULL;
+  TDSCONNECTINFO *connect_info; 
   char sTMP[256];
   FILE *pRepFD;
   char repfile[128];
@@ -117,7 +118,12 @@ int hackSQLServer(struct args_struct arg
   if ( args.verbose )
     printf("-- Logging in to %s --\n", args.sIP);
 
-  if( (tds = tds_connect(login)) !=NULL ) {
+  context = tds_alloc_context();
+  tds = tds_alloc_socket(context, 512);
+  tds_set_parent(tds, NULL);
+  connect_info = tds_read_config_info(NULL, login, context->locale);
+
+  if (!connect_info || tds_connect(tds, connect_info) != TDS_FAIL) {
 
     if ( !ifExistsXP(tds, "xp_cmdshell") ) {
       fprintf(stderr, "WARNING: could not find xp_cmdshell\n");
