openbsd-ports/security/sqlat/patches/patch-sqlupload_c
margarida 9f54a54744 Make sqlat compile with the new FreeTDS API.
Patches submitted upstream.
2003-06-03 01:26:50 +00:00

35 lines
1.0 KiB
Plaintext

$OpenBSD: patch-sqlupload_c,v 1.3 2003/06/03 01:26:50 margarida Exp $
--- sqlupload.c.orig Mon Dec 3 18:08:30 2001
+++ sqlupload.c Tue Jun 3 02:14:33 2003
@@ -22,7 +22,6 @@
#include "sqllib.h"
#include "util.h"
#include "constants.h"
-#include <getopt.h>
/*
Set a few default values
@@ -76,6 +75,8 @@ int SQLUpload(struct args_struct args) {
TDSLOGIN *login;
TDSSOCKET *tds;
+ TDSCONTEXT *context = NULL;
+ TDSCONNECTINFO *connect_info;
char sTMP[256];
char *pUploadFileName;
char bLooser = 0;
@@ -104,7 +105,12 @@ int SQLUpload(struct args_struct args) {
printf("-- Logging in to %s --\n", args.sIP);
/* try to login */
- 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) {
/* check for xp_cmdshell */
if ( !ifExistsXP(tds, "xp_cmdshell") ) {