windlopen.c   windlopen.c 
/* windlopen.c--Windows dynamic loader interface /* windlopen.c--Windows dynamic loader interface
* Ryan Troll * Ryan Troll
* $Id: windlopen.c,v 1.16 2003/10/20 15:19:59 rjs3 Exp $ * $Id: windlopen.c,v 1.17 2009/01/25 20:20:57 mel Exp $
*/ */
/* /*
* Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved . * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved .
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* *
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
skipping to change at line 137 skipping to change at line 137
{ {
int r = 0; int r = 0;
HINSTANCE library; HINSTANCE library;
lib_list_t *newhead; lib_list_t *newhead;
r = ((sasl_verifyfile_t *)(verifyfile_cb->proc)) r = ((sasl_verifyfile_t *)(verifyfile_cb->proc))
(verifyfile_cb->context, file, SASL_VRFY_PLUGIN); (verifyfile_cb->context, file, SASL_VRFY_PLUGIN);
if (r != SASL_OK) return r; if (r != SASL_OK) return r;
newhead = sasl_ALLOC(sizeof(lib_list_t)); newhead = sasl_ALLOC(sizeof(lib_list_t));
if(!newhead) return SASL_NOMEM; if (!newhead) return SASL_NOMEM;
if (!(library = LoadLibrary (file))) { if (!(library = LoadLibrary (file))) {
_sasl_log(NULL, SASL_LOG_ERR, _sasl_log(NULL, SASL_LOG_ERR,
"unable to LoadLibrary %s: %s", file, GetLastError()); "unable to LoadLibrary %s: %s", file, GetLastError());
sasl_FREE(newhead); sasl_FREE(newhead);
return SASL_FAIL; return SASL_FAIL;
} }
newhead->library = library; newhead->library = library;
newhead->next = lib_list_head; newhead->next = lib_list_head;
lib_list_head = newhead; lib_list_head = newhead;
*libraryptr = library; *libraryptr = library;
return SASL_OK; return SASL_OK;
} }
/* undoes actions done by _sasl_get_plugin */
void _sasl_remove_last_plugin()
{
lib_list_t *last_plugin = lib_list_head;
lib_list_head = lib_list_head->next;
if (last_plugin->library) {
FreeLibrary(last_plugin->library);
}
sasl_FREE(last_plugin);
}
/* gets the list of mechanisms */ /* gets the list of mechanisms */
int _sasl_load_plugins(const add_plugin_list_t *entrypoints, int _sasl_load_plugins(const add_plugin_list_t *entrypoints,
const sasl_callback_t *getpath_cb, const sasl_callback_t *getpath_cb,
const sasl_callback_t *verifyfile_cb) const sasl_callback_t *verifyfile_cb)
{ {
int result; int result;
char cur_dir[PATH_MAX], full_name[PATH_MAX+2], prefix[PATH_MAX+2]; char cur_dir[PATH_MAX], full_name[PATH_MAX+2], prefix[PATH_MAX+2];
/* 1 for '\\' 1 for trailing '\0' */ /* 1 for '\\' 1 for trailing '\0' */
char * pattern; char * pattern;
char c; char c;
skipping to change at line 243 skipping to change at line 254
} }
/* : Truncate "*.dll" */ /* : Truncate "*.dll" */
prefix[prefix_len] = '\0'; prefix[prefix_len] = '\0';
do { do {
size_t length; size_t length;
void *library; void *library;
char *c; char *c;
char plugname[PATH_MAX]; char plugname[PATH_MAX];
int entries;
length = strlen(finddata.name); length = strlen(finddata.name);
if (length < 5) { /* At least <Ch>.dll */ if (length < 5) { /* At least <Ch>.dll */
continue; /* can not possibly be what we're looking for */ continue; /* can not possibly be what we're looking for */
} }
/* : Check for overflow */ /* : Check for overflow */
if (length + prefix_len >= PATH_MAX) continue; /* too big */ if (length + prefix_len >= PATH_MAX) continue; /* too big */
if (stricmp(finddata.name + (length - strlen(DLL_SUFFIX)), DLL_S UFFIX) != 0) { if (stricmp(finddata.name + (length - strlen(DLL_SUFFIX)), DLL_S UFFIX) != 0) {
skipping to change at line 277 skipping to change at line 289
strcpy (plugname, finddata.name); strcpy (plugname, finddata.name);
c = strrchr(plugname, '.'); c = strrchr(plugname, '.');
if (c != NULL) *c = '\0'; if (c != NULL) *c = '\0';
result = _sasl_get_plugin (full_name, verifyfile_cb, &library); result = _sasl_get_plugin (full_name, verifyfile_cb, &library);
if (result != SASL_OK) { if (result != SASL_OK) {
continue; continue;
} }
entries = 0;
for (cur_ep = entrypoints; cur_ep->entryname; cur_ep++) { for (cur_ep = entrypoints; cur_ep->entryname; cur_ep++) {
_sasl_plugin_load(plugname, library, cur_ep->entryname, result = _sasl_plugin_load(plugname,
cur_ep->add_plugin); library,
cur_ep->entryname,
cur_ep->add_plugin);
if (result == SASL_OK) {
++entries;
}
/* If this fails, it's not the end of the world */ /* If this fails, it's not the end of the world */
} }
if (entries == 0) {
_sasl_remove_last_plugin();
}
} while (_findnext (fhandle, &finddata) == 0); } while (_findnext (fhandle, &finddata) == 0);
_findclose (fhandle); _findclose (fhandle);
} while ((c!='=') && (c!=0)); } while ((c!='=') && (c!=0));
return SASL_OK; return SASL_OK;
} }
int int
 End of changes. 7 change blocks. 
4 lines changed or deleted 26 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/