sasl/sasl.patch

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 144
f53f65b7bfb9
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

michael@144 1 Index: configure
michael@144 2 --- configure.orig 2006-05-18 21:30:13 +0200
michael@144 3 +++ configure 2008-12-25 18:48:51 +0100
michael@727 4 @@ -5015,9 +5015,6 @@
michael@144 5
michael@144 6 fi
michael@144 7
michael@144 8 -if test "$ac_cv_c_compiler_gnu" = yes; then
michael@144 9 - CFLAGS="-Wall -W ${CFLAGS}"
michael@144 10 -fi
michael@144 11
michael@144 12
michael@727 13 # Check whether --with-purecov was given.
michael@727 14 @@ -6422,7 +6419,7 @@
michael@144 15 fi
michael@144 16
michael@144 17 saved_LIBS=$LIBS
michael@727 18 - for dbname in ${with_bdb} db-4.7 db4.7 db47 db-4.6 db4.6 db46 db-4.5 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db
michael@144 19 + for dbname in db
michael@144 20 do
michael@144 21 LIBS="$saved_LIBS -l$dbname"
michael@144 22 cat >conftest.$ac_ext <<_ACEOF
michael@727 23 @@ -6526,6 +6523,54 @@
michael@727 24 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
michael@727 25 conftest$ac_exeext conftest.$ac_ext
michael@144 26 fi
michael@144 27 + if test "$dblib" = "no"; then
michael@144 28 + cat >conftest.$ac_ext <<_ACEOF
michael@144 29 +/* confdefs.h. */
michael@144 30 +_ACEOF
michael@144 31 +cat confdefs.h >>conftest.$ac_ext
michael@144 32 +cat >>conftest.$ac_ext <<_ACEOF
michael@144 33 +/* end confdefs.h. */
michael@144 34 +#include <db.h>
michael@144 35 +int
michael@144 36 +main ()
michael@144 37 +{
michael@144 38 +dbm_open(NULL, 0, 0, 0, NULL, NULL, NULL);
michael@144 39 + ;
michael@144 40 + return 0;
michael@144 41 +}
michael@144 42 +_ACEOF
michael@144 43 +rm -f conftest.$ac_objext conftest$ac_exeext
michael@144 44 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
michael@144 45 + (eval $ac_link) 2>conftest.er1
michael@144 46 + ac_status=$?
michael@144 47 + grep -v '^ *+' conftest.er1 >conftest.err
michael@144 48 + rm -f conftest.er1
michael@144 49 + cat conftest.err >&5
michael@144 50 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
michael@144 51 + (exit $ac_status); } &&
michael@144 52 + { ac_try='test -z "$ac_c_werror_flag"
michael@144 53 + || test ! -s conftest.err'
michael@144 54 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
michael@144 55 + (eval $ac_try) 2>&5
michael@144 56 + ac_status=$?
michael@144 57 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
michael@144 58 + (exit $ac_status); }; } &&
michael@144 59 + { ac_try='test -s conftest$ac_exeext'
michael@144 60 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
michael@144 61 + (eval $ac_try) 2>&5
michael@144 62 + ac_status=$?
michael@144 63 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
michael@144 64 + (exit $ac_status); }; }; then
michael@144 65 + BDB_LIBADD="$BDB_LIBADD -ldb"; dblib="berkeley"; dbname=db
michael@144 66 +else
michael@144 67 + echo "$as_me: failed program was:" >&5
michael@144 68 +sed 's/^/| /' conftest.$ac_ext >&5
michael@144 69 +
michael@144 70 +dblib="no"
michael@144 71 +fi
michael@144 72 +rm -f conftest.err conftest.$ac_objext \
michael@144 73 + conftest$ac_exeext conftest.$ac_ext
michael@144 74 + fi
michael@144 75 LIBS=$saved_LIBS
michael@144 76
michael@144 77 LDFLAGS=$BDB_SAVE_LDFLAGS
michael@727 78 @@ -7232,7 +7277,7 @@
michael@144 79 fi
michael@144 80
michael@144 81 saved_LIBS=$LIBS
michael@727 82 - for dbname in ${with_bdb} db-4.7 db4.7 db47 db-4.6 db4.6 db46 db-4.5 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db
michael@144 83 + for dbname in db
michael@144 84 do
michael@144 85 LIBS="$saved_LIBS -l$dbname"
michael@144 86 cat >conftest.$ac_ext <<_ACEOF
michael@727 87 @@ -7336,6 +7381,54 @@
michael@727 88 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
michael@727 89 conftest$ac_exeext conftest.$ac_ext
michael@144 90 fi
michael@144 91 + if test "$dblib" = "no"; then
michael@144 92 + cat >conftest.$ac_ext <<_ACEOF
michael@144 93 +/* confdefs.h. */
michael@144 94 +_ACEOF
michael@144 95 +cat confdefs.h >>conftest.$ac_ext
michael@144 96 +cat >>conftest.$ac_ext <<_ACEOF
michael@144 97 +/* end confdefs.h. */
michael@144 98 +#include <db.h>
michael@144 99 +int
michael@144 100 +main ()
michael@144 101 +{
michael@144 102 +dbm_open(NULL, 0, 0, 0, NULL, NULL, NULL);
michael@144 103 + ;
michael@144 104 + return 0;
michael@144 105 +}
michael@144 106 +_ACEOF
michael@144 107 +rm -f conftest.$ac_objext conftest$ac_exeext
michael@144 108 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
michael@144 109 + (eval $ac_link) 2>conftest.er1
michael@144 110 + ac_status=$?
michael@144 111 + grep -v '^ *+' conftest.er1 >conftest.err
michael@144 112 + rm -f conftest.er1
michael@144 113 + cat conftest.err >&5
michael@144 114 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
michael@144 115 + (exit $ac_status); } &&
michael@144 116 + { ac_try='test -z "$ac_c_werror_flag"
michael@144 117 + || test ! -s conftest.err'
michael@144 118 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
michael@144 119 + (eval $ac_try) 2>&5
michael@144 120 + ac_status=$?
michael@144 121 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
michael@144 122 + (exit $ac_status); }; } &&
michael@144 123 + { ac_try='test -s conftest$ac_exeext'
michael@144 124 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
michael@144 125 + (eval $ac_try) 2>&5
michael@144 126 + ac_status=$?
michael@144 127 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
michael@144 128 + (exit $ac_status); }; }; then
michael@144 129 + BDB_LIBADD="$BDB_LIBADD -ldb"; dblib="berkeley"; dbname=db
michael@144 130 +else
michael@144 131 + echo "$as_me: failed program was:" >&5
michael@144 132 +sed 's/^/| /' conftest.$ac_ext >&5
michael@144 133 +
michael@144 134 +dblib="no"
michael@144 135 +fi
michael@144 136 +rm -f conftest.err conftest.$ac_objext \
michael@144 137 + conftest$ac_exeext conftest.$ac_ext
michael@144 138 + fi
michael@144 139 LIBS=$saved_LIBS
michael@144 140
michael@144 141 LDFLAGS=$BDB_SAVE_LDFLAGS
michael@727 142 @@ -14476,20 +14569,20 @@
michael@144 143 fi
michael@144 144
michael@144 145 LIB_SQLITE_DIR=$LIB_SQLITE
michael@144 146 - LIB_SQLITE="$LIB_SQLITE -lsqlite"
michael@144 147 + LIB_SQLITE="$LIB_SQLITE -lsqlite3"
michael@144 148
michael@144 149 if test -d ${with_sqlite}/include; then
michael@144 150 CPPFLAGS="${CPPFLAGS} -I${with_sqlite}/include"
michael@144 151 else
michael@144 152 CPPFLAGS="${CPPFLAGS} -I${with_sqlite}"
michael@144 153 fi
michael@727 154 - { $as_echo "$as_me:$LINENO: checking for sqlite_open in -lsqlite" >&5
michael@727 155 -$as_echo_n "checking for sqlite_open in -lsqlite... " >&6; }
michael@144 156 + echo "$as_me:$LINENO: checking for sqlite3_open in -lsqlite3" >&5
michael@144 157 +echo $ECHO_N "checking for sqlite3_open in -lsqlite3... $ECHO_C" >&6
michael@144 158 if test "${ac_cv_lib_sqlite_sqlite_open+set}" = set; then
michael@727 159 $as_echo_n "(cached) " >&6
michael@144 160 else
michael@144 161 ac_check_lib_save_LIBS=$LIBS
michael@144 162 -LIBS="-lsqlite $LIB_SQLITE_DIR $LIBS"
michael@144 163 +LIBS="-lsqlite3 $LIB_SQLITE_DIR $LIBS"
michael@144 164 cat >conftest.$ac_ext <<_ACEOF
michael@144 165 /* confdefs.h. */
michael@727 166 _ACEOF
michael@727 167 @@ -14503,11 +14596,11 @@
michael@727 168 #ifdef __cplusplus
michael@727 169 extern "C"
michael@144 170 #endif
michael@144 171 -char sqlite_open ();
michael@144 172 +char sqlite3_open ();
michael@144 173 int
michael@144 174 main ()
michael@144 175 {
michael@727 176 -return sqlite_open ();
michael@727 177 +return sqlite3_open ();
michael@144 178 ;
michael@144 179 return 0;
michael@144 180 }
michael@144 181 Index: lib/saslint.h
michael@144 182 --- lib/saslint.h.orig 2006-04-18 22:25:45 +0200
michael@144 183 +++ lib/saslint.h 2008-12-25 18:48:51 +0100
michael@727 184 @@ -118,8 +118,6 @@
michael@144 185 const char *appname;
michael@144 186 } sasl_global_callbacks_t;
michael@144 187
michael@144 188 -extern sasl_global_callbacks_t global_callbacks;
michael@144 189 -
michael@144 190 typedef struct _sasl_external_properties
michael@144 191 {
michael@144 192 sasl_ssf_t ssf;
michael@144 193 Index: lib/server.c
michael@144 194 --- lib/server.c.orig 2006-05-17 18:46:13 +0200
michael@144 195 +++ lib/server.c 2008-12-25 18:48:51 +0100
michael@727 196 @@ -90,7 +90,7 @@
michael@144 197
michael@144 198 static mech_list_t *mechlist = NULL; /* global var which holds the list */
michael@144 199
michael@144 200 -sasl_global_callbacks_t global_callbacks;
michael@144 201 +static sasl_global_callbacks_t global_callbacks;
michael@144 202
michael@144 203 /* set the password for a user
michael@144 204 * conn -- SASL connection
michael@727 205 @@ -606,16 +606,8 @@
michael@144 206 return SASL_CONTINUE;
michael@144 207 }
michael@144 208
michael@144 209 - /* get the path to the config file */
michael@144 210 - getconfpath_cb = _sasl_find_getconfpath_callback( global_callbacks.callbacks );
michael@144 211 - if (getconfpath_cb == NULL) return SASL_BADPARAM;
michael@144 212 -
michael@144 213 - /* getconfpath_cb->proc MUST be a sasl_getconfpath_t; if only C had a type
michael@144 214 - system */
michael@144 215 - result = ((sasl_getconfpath_t *)(getconfpath_cb->proc))(getconfpath_cb->context,
michael@727 216 - (char **) &path_to_config);
michael@144 217 - if (result != SASL_OK) goto done;
michael@144 218 - if (path_to_config == NULL) path_to_config = "";
michael@144 219 + result = SASL_OK;
michael@144 220 + path_to_config = "@l_sysconfdir@";
michael@144 221
michael@144 222 next = path_to_config;
michael@144 223
michael@144 224 Index: plugins/sql.c
michael@144 225 --- plugins/sql.c.orig 2006-04-07 15:42:16 +0200
michael@144 226 +++ plugins/sql.c 2008-12-25 21:57:47 +0100
michael@144 227 @@ -150,9 +150,15 @@
michael@144 228 return -1;
michael@144 229 }
michael@144 230 if (value) {
michael@144 231 - strncpy(value, row[0], size-2);
michael@144 232 - value[size-1] = '\0';
michael@144 233 - if (value_len) *value_len = strlen(value);
michael@144 234 + unsigned long *col_lens;
michael@144 235 + size_t col_len;
michael@144 236 + col_lens = mysql_fetch_lengths(result);
michael@144 237 + col_len = (size_t)col_lens[0];
michael@144 238 + if (col_len > size - 1);
michael@144 239 + col_len = size - 1;
michael@144 240 + memcpy(value, row[0], col_len);
michael@144 241 + value[col_len] = '\0';
michael@144 242 + if (value_len) *value_len = col_len;
michael@144 243 }
michael@144 244
michael@144 245 /* free result */
michael@144 246 @@ -277,7 +283,7 @@
michael@144 247 ExecStatusType status;
michael@144 248
michael@144 249 /* run the query */
michael@144 250 - result = PQexec(conn, cmd);
michael@144 251 + result = PQexecParams(conn, cmd, 0, NULL, NULL, NULL, NULL, 1);
michael@144 252
michael@144 253 /* check the status */
michael@144 254 status = PQresultStatus(result);
michael@144 255 @@ -298,6 +304,7 @@
michael@144 256 row_count = PQntuples(result);
michael@144 257 if (!row_count) {
michael@144 258 /* umm nothing found */
michael@144 259 + utils->log(NULL, SASL_LOG_DEBUG, "sql plugin: no result found for query %s", cmd);
michael@144 260 utils->log(NULL, SASL_LOG_NOTE, "sql plugin: no result found");
michael@144 261 PQclear(result);
michael@144 262 return -1;
michael@144 263 @@ -310,9 +317,26 @@
michael@144 264 /* now get the result set value and value_len */
michael@144 265 /* we only fetch one because we don't care about the rest */
michael@144 266 if (value) {
michael@144 267 - strncpy(value, PQgetvalue(result,0,0), size-2);
michael@144 268 - value[size-1] = '\0';
michael@144 269 - if (value_len) *value_len = strlen(value);
michael@144 270 + if (PQgetisnull(result, 0, 0)) {
michael@144 271 + size_t col_len;
michael@144 272 + col_len = strlen(SQL_NULL_VALUE);
michael@144 273 + if (col_len > size - 1)
michael@144 274 + col_len = size - 1;
michael@144 275 + memcpy(value, SQL_NULL_VALUE, col_len);
michael@144 276 + value[col_len] = '\0';
michael@144 277 + if (value_len)
michael@144 278 + *value_len = col_len;
michael@144 279 + }
michael@144 280 + else {
michael@144 281 + size_t col_len;
michael@144 282 + col_len = (size_t)PQgetlength(result, 0, 0);
michael@144 283 + if (col_len > size - 1);
michael@144 284 + col_len = size - 1;
michael@144 285 + memcpy(value, PQgetvalue(result, 0, 0), col_len);
michael@144 286 + value[col_len] = '\0';
michael@144 287 + if (value_len)
michael@144 288 + *value_len = col_len;
michael@144 289 + }
michael@144 290 }
michael@144 291
michael@144 292 /* free result */
michael@144 293 @@ -342,7 +366,7 @@
michael@144 294 #endif /* HAVE_PGSQL */
michael@144 295
michael@144 296 #ifdef HAVE_SQLITE
michael@144 297 -#include <sqlite.h>
michael@144 298 +#include <sqlite3.h>
michael@144 299
michael@144 300 static void *_sqlite_open(char *host __attribute__((unused)),
michael@144 301 char *port __attribute__((unused)),
michael@144 302 @@ -352,21 +376,23 @@
michael@144 303 const char *database, const sasl_utils_t *utils)
michael@144 304 {
michael@144 305 int rc;
michael@144 306 - sqlite *db;
michael@144 307 + sqlite3 *db;
michael@144 308 char *zErrMsg = NULL;
michael@144 309
michael@144 310 - db = sqlite_open(database, 0, &zErrMsg);
michael@144 311 - if (db == NULL) {
michael@144 312 + rc = sqlite3_open(database, &db);
michael@144 313 + if (rc != SQLITE_OK) {
michael@144 314 + zErrMsg = (char *)sqlite3_errmsg(db);
michael@144 315 utils->log(NULL, SASL_LOG_ERR, "sql plugin: %s", zErrMsg);
michael@144 316 - sqlite_freemem (zErrMsg);
michael@144 317 + sqlite3_free (zErrMsg);
michael@144 318 + sqlite3_close (db);
michael@144 319 return NULL;
michael@144 320 }
michael@144 321
michael@144 322 - rc = sqlite_exec(db, "PRAGMA empty_result_callbacks = ON", NULL, NULL, &zErrMsg);
michael@144 323 + rc = sqlite3_exec(db, "PRAGMA empty_result_callbacks = ON", NULL, NULL, &zErrMsg);
michael@144 324 if (rc != SQLITE_OK) {
michael@144 325 utils->log(NULL, SASL_LOG_ERR, "sql plugin: %s", zErrMsg);
michael@144 326 - sqlite_freemem (zErrMsg);
michael@144 327 - sqlite_close(db);
michael@144 328 + sqlite3_free (zErrMsg);
michael@144 329 + sqlite3_close(db);
michael@144 330 return NULL;
michael@144 331 }
michael@144 332
michael@144 333 @@ -388,62 +414,67 @@
michael@144 334 return 0;
michael@144 335 }
michael@144 336
michael@144 337 -static int sqlite_my_callback(void *pArg, int argc __attribute__((unused)),
michael@144 338 - char **argv,
michael@144 339 - char **columnNames __attribute__((unused)))
michael@144 340 -{
michael@144 341 - char **result = (char**)pArg;
michael@144 342 -
michael@144 343 - if (argv == NULL) {
michael@144 344 - *result = NULL; /* no record */
michael@144 345 - } else if (argv[0] == NULL) {
michael@144 346 - *result = strdup(SQL_NULL_VALUE); /* NULL IS SQL_NULL_VALUE */
michael@144 347 - } else {
michael@144 348 - *result = strdup(argv[0]);
michael@144 349 - }
michael@144 350 -
michael@144 351 - return /*ABORT*/1;
michael@144 352 -}
michael@144 353 -
michael@144 354 static int _sqlite_exec(void *db, const char *cmd, char *value, size_t size,
michael@144 355 size_t *value_len, const sasl_utils_t *utils)
michael@144 356 {
michael@144 357 int rc;
michael@144 358 - char *result = NULL;
michael@144 359 - char *zErrMsg = NULL;
michael@144 360 + sqlite3_stmt *stmt;
michael@144 361 + const char *todo;
michael@144 362 + size_t len;
michael@144 363
michael@144 364 - rc = sqlite_exec((sqlite*)db, cmd, sqlite_my_callback, (void*)&result, &zErrMsg);
michael@144 365 - if (rc != SQLITE_OK && rc != SQLITE_ABORT) {
michael@144 366 - utils->log(NULL, SASL_LOG_DEBUG, "sql plugin: %s ", zErrMsg);
michael@144 367 - sqlite_freemem (zErrMsg);
michael@144 368 + rc = sqlite3_prepare((sqlite3*)db, cmd, (int)strlen(cmd), &stmt, &todo);
michael@144 369 + if (rc != SQLITE_OK) {
michael@144 370 + utils->log(NULL, SASL_LOG_DEBUG, "sql plugin error: %s", sqlite3_errmsg((sqlite3*)db));
michael@144 371 return -1;
michael@144 372 }
michael@144 373 -
michael@144 374 - if (rc == SQLITE_OK) {
michael@144 375 + rc = sqlite3_step(stmt);
michael@144 376 + if (rc != SQLITE_ROW && rc != SQLITE_DONE) {
michael@144 377 + utils->log(NULL, SASL_LOG_DEBUG, "sql plugin error: %s", sqlite3_errmsg((sqlite3*)db));
michael@144 378 + sqlite3_finalize(stmt);
michael@144 379 + return -1;
michael@144 380 + }
michael@144 381 + if (sqlite3_column_count(stmt) == 0) {
michael@144 382 /* no results (BEGIN, COMMIT, DELETE, INSERT, UPDATE) */
michael@144 383 + sqlite3_finalize(stmt);
michael@144 384 return 0;
michael@144 385 }
michael@144 386 -
michael@144 387 - if (result == NULL) {
michael@144 388 + if (rc == SQLITE_DONE) {
michael@144 389 /* umm nothing found */
michael@144 390 + utils->log(NULL, SASL_LOG_DEBUG, "sql plugin: no result found for query %s", cmd);
michael@144 391 utils->log(NULL, SASL_LOG_NOTE, "sql plugin: no result found");
michael@144 392 + sqlite3_finalize(stmt);
michael@144 393 return -1;
michael@144 394 }
michael@144 395 -
michael@144 396 - /* XXX: Duplication cannot be found by this method. */
michael@144 397 -
michael@144 398 - /* now get the result set value and value_len */
michael@144 399 - /* we only fetch one because we don't care about the rest */
michael@144 400 - if (value) {
michael@144 401 - strncpy(value, result, size - 2);
michael@144 402 - value[size - 1] = '\0';
michael@144 403 - if (value_len) {
michael@144 404 - *value_len = strlen(value);
michael@144 405 - }
michael@144 406 + rc = sqlite3_column_type(stmt, 0);
michael@144 407 + switch (rc) {
michael@144 408 + case SQLITE_NULL: {
michael@144 409 + len = strlen(SQL_NULL_VALUE);
michael@144 410 + if (len > size - 1)
michael@144 411 + len = size - 1;
michael@144 412 + memcpy(value, SQL_NULL_VALUE, len);
michael@144 413 + value[len] = '\0';
michael@144 414 + if (value_len)
michael@144 415 + *value_len = len;
michael@144 416 + break;
michael@144 417 + }
michael@144 418 + default: {
michael@144 419 + const void *blob = sqlite3_column_blob(stmt, 0);
michael@144 420 + len = (size_t)sqlite3_column_bytes(stmt, 0);
michael@144 421 + if (len > size - 1)
michael@144 422 + len = size - 1;
michael@144 423 + memcpy(value, blob, len);
michael@144 424 + value[len] = '\0';
michael@144 425 + if (value_len)
michael@144 426 + *value_len = len;
michael@144 427 + break;
michael@144 428 + }
michael@144 429 }
michael@144 430 -
michael@144 431 - /* free result */
michael@144 432 - free(result);
michael@144 433 + rc = sqlite3_step(stmt);
michael@144 434 + if (rc != SQLITE_DONE) {
michael@144 435 + utils->log(NULL, SASL_LOG_WARN,
michael@144 436 + "sql plugin: found duplicate row for query %s", cmd);
michael@144 437 + }
michael@144 438 + sqlite3_finalize(stmt);
michael@144 439 return 0;
michael@144 440 }
michael@144 441
michael@144 442 @@ -464,7 +495,7 @@
michael@144 443
michael@144 444 static void _sqlite_close(void *db)
michael@144 445 {
michael@144 446 - sqlite_close((sqlite*)db);
michael@144 447 + sqlite3_close((sqlite3 *)db);
michael@144 448 }
michael@144 449 #endif /* HAVE_SQLITE */
michael@144 450
michael@727 451 @@ -918,7 +949,7 @@
michael@144 452 settings = (sql_settings_t *) glob_context;
michael@144 453
michael@144 454 sparams->utils->log(NULL, SASL_LOG_DEBUG,
michael@144 455 - "sql plugin Parse the username %s\n", user);
michael@144 456 + "sql plugin parse the username %s\n", user);
michael@144 457
michael@144 458 user_buf = sparams->utils->malloc(ulen + 1);
michael@727 459 if (!user_buf) {
michael@727 460 @@ -1022,7 +1053,7 @@
michael@144 461 }
michael@144 462
michael@144 463 sparams->utils->log(NULL, SASL_LOG_DEBUG,
michael@144 464 - "sql plugin create statement from %s %s %s\n",
michael@144 465 + "sql plugin create statement from name=%s user=%s realm=%s\n",
michael@144 466 realname, escap_userid, escap_realm);
michael@144 467
michael@144 468 /* create a statement that we will use */
michael@727 469 @@ -1043,12 +1074,18 @@
michael@144 470 /* run the query */
michael@144 471 if (!settings->sql_engine->sql_exec(conn, query, value, sizeof(value),
michael@144 472 &value_len, sparams->utils)) {
michael@144 473 + sparams->utils->log(NULL, SASL_LOG_DEBUG,
michael@144 474 + "sql plugin query successful\n");
michael@727 475 sparams->utils->prop_set(sparams->propctx,
michael@727 476 cur->name,
michael@727 477 value,
michael@727 478 (int)value_len);
michael@727 479 ret = SASL_OK;
michael@144 480 }
michael@144 481 + else {
michael@144 482 + sparams->utils->log(NULL, SASL_LOG_DEBUG,
michael@144 483 + "sql plugin query failed\n");
michael@144 484 + }
michael@144 485
michael@144 486 sparams->utils->free(query);
michael@144 487 }
michael@144 488 Index: sample/client.c
michael@144 489 --- sample/client.c.orig 2004-03-09 18:35:32 +0100
michael@144 490 +++ sample/client.c 2008-12-25 18:48:51 +0100
michael@727 491 @@ -137,13 +137,11 @@
michael@144 492 return SASL_OK;
michael@144 493 }
michael@144 494
michael@144 495 -#ifndef HAVE_GETPASSPHRASE
michael@144 496 static char *
michael@144 497 -getpassphrase(const char *prompt)
michael@144 498 +my_getpassphrase(const char *prompt)
michael@144 499 {
michael@144 500 return getpass(prompt);
michael@144 501 }
michael@144 502 -#endif /* ! HAVE_GETPASSPHRASE */
michael@144 503
michael@144 504 static int
michael@144 505 getsecret(sasl_conn_t *conn,
michael@727 506 @@ -159,7 +157,7 @@
michael@144 507 if (! conn || ! psecret || id != SASL_CB_PASS)
michael@144 508 return SASL_BADPARAM;
michael@144 509
michael@144 510 - password = getpassphrase("Password: ");
michael@144 511 + password = my_getpassphrase("Password: ");
michael@144 512 if (! password)
michael@144 513 return SASL_FAIL;
michael@144 514
michael@144 515 Index: sample/sample-client.c
michael@144 516 --- sample/sample-client.c.orig 2004-10-26 13:14:33 +0200
michael@144 517 +++ sample/sample-client.c 2008-12-25 18:48:51 +0100
michael@727 518 @@ -245,13 +245,11 @@
michael@144 519 return SASL_OK;
michael@144 520 }
michael@144 521
michael@144 522 -#ifndef HAVE_GETPASSPHRASE
michael@144 523 static char *
michael@144 524 -getpassphrase(const char *prompt)
michael@144 525 +my_getpassphrase(const char *prompt)
michael@144 526 {
michael@144 527 return getpass(prompt);
michael@144 528 }
michael@144 529 -#endif /* ! HAVE_GETPASSPHRASE */
michael@144 530
michael@144 531 static int
michael@144 532 getsecret(sasl_conn_t *conn,
michael@727 533 @@ -265,7 +263,7 @@
michael@144 534 if (! conn || ! psecret || id != SASL_CB_PASS)
michael@144 535 return SASL_BADPARAM;
michael@144 536
michael@144 537 - password = getpassphrase("Password: ");
michael@144 538 + password = my_getpassphrase("Password: ");
michael@144 539 if (! password)
michael@144 540 return SASL_FAIL;
michael@144 541
michael@727 542 @@ -308,7 +306,7 @@
michael@144 543 fflush(stdout);
michael@144 544
michael@144 545 if (id == SASL_CB_ECHOPROMPT) {
michael@144 546 - char *original = getpassphrase("");
michael@144 547 + char *original = my_getpassphrase("");
michael@144 548 if (! original)
michael@144 549 return SASL_FAIL;
michael@144 550 if (*original)
michael@144 551 Index: saslauthd/Makefile.am
michael@144 552 --- saslauthd/Makefile.am.orig 2006-05-17 18:46:17 +0200
michael@144 553 +++ saslauthd/Makefile.am 2008-12-25 18:48:51 +0100
michael@144 554 @@ -36,4 +36,4 @@
michael@144 555
michael@144 556 install-data-local: saslauthd.8
michael@144 557 $(mkinstalldirs) $(DESTDIR)$(mandir)/man8
michael@144 558 - $(INSTALL_DATA) $(srcdir)/saslauthd.8 $(DESTDIR)$(mandir)/man8/saslauthd.8
michael@144 559 + $(INSTALL_DATA) $(srcdir)/saslauthd.mdoc $(DESTDIR)$(mandir)/man8/saslauthd.8
michael@144 560 Index: saslauthd/Makefile.in
michael@144 561 --- saslauthd/Makefile.in.orig 2008-12-25 18:48:51 +0100
michael@144 562 +++ saslauthd/Makefile.in 2008-12-25 18:48:51 +0100
michael@727 563 @@ -722,7 +722,7 @@
michael@144 564
michael@144 565 install-data-local: saslauthd.8
michael@144 566 $(mkinstalldirs) $(DESTDIR)$(mandir)/man8
michael@144 567 - $(INSTALL_DATA) $(srcdir)/saslauthd.8 $(DESTDIR)$(mandir)/man8/saslauthd.8
michael@144 568 + $(INSTALL_DATA) $(srcdir)/saslauthd.mdoc $(DESTDIR)$(mandir)/man8/saslauthd.8
michael@727 569
michael@144 570 # Tell versions [3.59,3.63) of GNU make to not export all variables.
michael@144 571 # Otherwise a system limit (for SysV at least) may be exceeded.
michael@144 572 Index: saslauthd/lak.c
michael@144 573 --- saslauthd/lak.c.orig 2005-05-15 07:49:51 +0200
michael@144 574 +++ saslauthd/lak.c 2008-12-25 18:48:51 +0100
michael@144 575 @@ -47,6 +47,7 @@
michael@144 576 #include <crypt.h>
michael@144 577 #endif
michael@144 578
michael@144 579 +#include "saslauthd.h" /* get strlcpy macro for non-BSD; get HAVE_OPENSSL from config.h */
michael@144 580 #ifdef HAVE_OPENSSL
michael@144 581 #ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT
michael@144 582 #define OPENSSL_DISABLE_OLD_DES_SUPPORT
michael@727 583 @@ -58,7 +59,7 @@
michael@727 584 #define LDAP_DEPRECATED 1
michael@144 585 #include <ldap.h>
michael@144 586 #include <lber.h>
michael@144 587 -#include <sasl.h>
michael@144 588 +#include "sasl.h"
michael@144 589 #include "lak.h"
michael@144 590
michael@144 591 typedef struct lak_auth_method {

mercurial