changeset 23624:85189641a970

This should have been part of the previous commit related to no longer installing our own MIT Kerberos libraries. This also tries to fix the PATH at runtime if MIT Kerberos is installed.
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 30 Jul 2008 21:09:51 +0000
parents c014c3fe0de9
children ad68d734205a
files libpurple/protocols/jabber/Makefile.mingw pidgin/win32/winpidgin.c
diffstat 2 files changed, 52 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/Makefile.mingw	Wed Jul 30 20:36:18 2008 +0000
+++ b/libpurple/protocols/jabber/Makefile.mingw	Wed Jul 30 21:09:51 2008 +0000
@@ -88,10 +88,6 @@
 LIB_PATHS += -L$(CYRUS_SASL_TOP)/bin
 LIBS += -llibsasl
 CYRUS_SASL_DLLS = \
-			$(CYRUS_SASL_TOP)/bin/comerr32.dll \
-			$(CYRUS_SASL_TOP)/bin/gssapi32.dll \
-			$(CYRUS_SASL_TOP)/bin/k5sprt32.dll \
-			$(CYRUS_SASL_TOP)/bin/krb5_32.dll \
 			$(CYRUS_SASL_TOP)/bin/libsasl.dll
 
 CYRUS_SASL_PLUGINS = \
--- a/pidgin/win32/winpidgin.c	Wed Jul 30 20:36:18 2008 +0000
+++ b/pidgin/win32/winpidgin.c	Wed Jul 30 21:09:51 2008 +0000
@@ -441,45 +441,77 @@
 	_putenv(envstr);
 }
 
-static void winpidgin_add_perl_to_path() {
+
+static void winpidgin_add_stuff_to_path() {
 	char perl_path[MAX_PATH + 1];
-	DWORD plen = sizeof(perl_path);
+	char *ppath = NULL;
+	char mit_kerberos_path[MAX_PATH + 1];
+	char *mpath = NULL;
+	DWORD plen;
 
 	printf("%s", "Looking for Perl... ");
 
+	plen = sizeof(perl_path);
 	if (read_reg_string(HKEY_LOCAL_MACHINE, "SOFTWARE\\Perl", "",
 			    (LPBYTE) &perl_path, &plen)) {
-		const char *path = getenv("PATH");
-		/* Enough to add "PATH=" + ";"  + perl_path + "\\bin" + \0 */
-
 		/* We *could* check for perl510.dll, but it seems unnecessary. */
-
 		printf("found in '%s'.\n", perl_path);
 
-		if (perl_path[strlen(perl_path) - 1] != '\\') {
+		if (perl_path[strlen(perl_path) - 1] != '\\')
 			strcat(perl_path, "\\");
-		}
 		strcat(perl_path, "bin");
 
-		if (path == NULL || !strstr(path, perl_path)) {
-			int newlen = (path ? strlen(path) : 0) + strlen(perl_path) + 10;
-			char *newpath = malloc(newlen);
+		ppath = perl_path;
+	} else
+		printf("%s", "not found.\n");
+
+	printf("%s", "Looking for MIT Kerberos... ");
+
+	plen = sizeof(mit_kerberos_path);
+	if (read_reg_string(HKEY_LOCAL_MACHINE, "SOFTWARE\\MIT\\Kerberos", "InstallDir",
+			    (LPBYTE) &mit_kerberos_path, &plen)) {
+		/* We *could* check for gssapi32.dll */
+		printf("found in '%s'.\n", mit_kerberos_path);
+
+		if (mit_kerberos_path[strlen(mit_kerberos_path) - 1] != '\\')
+			strcat(mit_kerberos_path, "\\");
+		strcat(mit_kerberos_path, "bin");
+
+		mpath = mit_kerberos_path;
+	} else
+		printf("%s", "not found.\n");
+
+	if (ppath != NULL || mpath != NULL) {
+		const char *path = getenv("PATH");
+		BOOL add_ppath = ppath != NULL && (path == NULL || !strstr(path, ppath));
+		BOOL add_mpath = mpath != NULL && (path == NULL || !strstr(path, mpath));
+		char *newpath;
+		int newlen;
+
+		if (add_ppath || add_mpath) {
+			/* Enough to add "PATH=" + path + ";"  + ppath + ";" + mpath + \0 */
+			newlen = 6 + (path ? strlen(path) + 1 : 0);
+			if (add_ppath)
+				newlen += strlen(ppath) + 1;
+			if (add_mpath)
+				newlen += strlen(mpath) + 1;
+			newpath = malloc(newlen);
 			*newpath = '\0';
 
-			_snprintf(newpath, newlen, "PATH=%s%s%s",
+			_snprintf(newpath, newlen, "PATH=%s%s%s%s%s%s",
 				  path ? path : "",
 				  path ? ";" : "",
-				  perl_path);
+				  add_ppath ? ppath : "",
+				  add_ppath ? ";" : "",
+				  add_mpath ? mpath : "",
+				  add_mpath ? ";" : "");
 
-			printf("Adding Perl to PATH: %s\n", newpath);
+			printf("New PATH: %s\n", newpath);
 
 			_putenv(newpath);
 			free(newpath);
-		} else
-			printf("%s\n", "Perl already in PATH.");
-	} else
-		printf("%s", "not found.\n");
-
+		}
+	}
 }
 
 #define PIDGIN_WM_FOCUS_REQUEST (WM_APP + 13)
@@ -672,7 +704,7 @@
 
 	winpidgin_set_locale();
 
-	winpidgin_add_perl_to_path();
+	winpidgin_add_stuff_to_path();
 
 	/* If help, version or multiple flag used, do not check Mutex */
 	if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v"))