Esempio n. 1
0
static int
get_apache_registry(char *home, int size)
{
	HKEY hKeyApache;
	char version[MAX_PATH + 1];
	char bestVersion[1024];
	int index = 0;
	HKEY hKeyVersion = 0;
	
	if (! (hKeyApache = reg_lookup(HKEY_LOCAL_MACHINE, HKEY_APACHE)))
		return 0;

	bestVersion[0] = 0;
	while ((RegEnumKey(hKeyApache, index++, version, sizeof(version))) == ERROR_SUCCESS) {
		if (strcmp(version, bestVersion) > 0)
			strcpy(bestVersion, version);
	}

	if (! (hKeyVersion = reg_lookup(hKeyApache, bestVersion)))
		return 0;

	if (! reg_query_string(hKeyVersion, HKEY_APACHE_HOME, home))
		return 0;

	return 1;
}
Esempio n. 2
0
static int
reg_require (mu_sieve_machine_t mach, mu_list_t list, const char *name)
{
  mu_sieve_register_t *reg = reg_lookup (list, name);
  if (!reg)
    {
      if (!(mu_sieve_load_ext (mach, name) == 0
	    && (reg = reg_lookup (list, name)) != NULL))
	return 1;
    }
  reg->required = 1;
  return 0;
}
Esempio n. 3
0
static char *
add_resin_filter_registry(HWND hDlg, char *filter_path)
{
	char buf[1024];
	HKEY hKeyParams;
	
	buf[0] = 0;
	if (! (hKeyParams = reg_lookup(HKEY_LOCAL_MACHINE, IIS_PARAM)))
		return "Can't open IIS Parameters";

	reg_query_string(hKeyParams, TEXT("Filter DLLs"), buf);

	RegCloseKey(hKeyParams);

	if (strstr("isapi_srun.dll", buf))
		return 0;

	if (buf[0])
		strcat(buf, ",");

	strcat(buf, "isapi_srun.dll");

	reg_set_string(IIS_PARAM, "Filter DLLs", buf);


	return 0;
}
Esempio n. 4
0
int
get_iis_script_dir(char *dir)
{
	*dir = 0;

	if (get_iis_script_dir_from_metabase(dir)) {
		return 1;
	}

	HKEY hKeyRoot = reg_lookup(HKEY_LOCAL_MACHINE, TEXT(IIS_ROOTS));
	if (! hKeyRoot) {
		strcpy(dir, "");
		return 0;
	}

	if (reg_query_string(hKeyRoot, TEXT("/SCRIPTS"), dir))
		return 1;

	if (reg_query_string(hKeyRoot, TEXT("/"), dir))
		return 1;

	strcpy(dir, "unknown");

	return 1;
}
char *
get_website_home()
{
    char buf[1024];
    HKEY hKeyRoot;

    hKeyRoot = reg_lookup(HKEY_LOCAL_MACHINE, ROOT_KEY);
    if(hKeyRoot == 0)
        return 0;
    if(reg_query_string(hKeyRoot, "ServerRoot", buf) == 0)
        return 0;
    RegCloseKey(hKeyRoot);
    return strdup(buf);
}
Esempio n. 6
0
mu_sieve_register_t *
mu_sieve_action_lookup (mu_sieve_machine_t mach, const char *name)
{
  mu_sieve_register_t *reg = reg_lookup (mach->action_list, name);
  return (reg && reg->handler) ? reg : NULL;
}
char *
configure_website(HWND hDlg, char *resin_home, char *website_home)
{
    char src_name[1024];
    char dst_name[1024];
    FILE *src_file;
    FILE *dst_file;
    HKEY hKey;
    char buf[1024];
    char *cp;
    int len;

    //
    // Copy the ISAPI DLL to WebSite's home directory
    //
    sprintf(src_name, "%s\\bin\\isapi_srun.dll", resin_home);
    sprintf(dst_name, "%s\\isapi_srun.dll", website_home);

    dst_file = fopen(dst_name, "w+b");
    if (! dst_file)
        return "You must stop WebSite for setup to install the Resin ISAPI connector.";

    src_file = fopen(src_name, "rb");
    if (! src_file) {
        fclose(dst_file);
        return "Can't open isapi_srun.dll in RESIN_HOME";
    }

    while ((len = fread(buf, 1, sizeof(buf), src_file)) > 0) {
        fwrite(buf, 1, len, dst_file);
    }

    fclose(src_file);
    fclose(dst_file);

    //
    // Create the associations and server-side content type so that
    // WebSite knows what to do with .jsp, .xml, and .xtp files.
    //
    hKey = reg_lookup(HKEY_LOCAL_MACHINE, ASSOC_KEY);
    if(hKey == 0)
        return "Can't find WebSite association data in registry";

    len = strlen(dst_name) + 1;
    RegSetValueEx(hKey, ".jsp", 0, REG_SZ, (CONST BYTE *)dst_name, len);
    RegSetValueEx(hKey, ".xml", 0, REG_SZ, (CONST BYTE *)dst_name, len);
    RegSetValueEx(hKey, ".xtp", 0, REG_SZ, (CONST BYTE *)dst_name, len);
    RegCloseKey(hKey);

    hKey = reg_lookup(HKEY_LOCAL_MACHINE, TYPE_KEY);
    if(hKey == 0)
        return "Can't find WebSite type data in registry";

    cp = "wwwserver/isapi";
    len = strlen(cp) + 1;
    RegSetValueEx(hKey, ".jsp", 0, REG_SZ, (CONST BYTE *)cp, len);
    RegSetValueEx(hKey, ".xml", 0, REG_SZ, (CONST BYTE *)cp, len);
    RegSetValueEx(hKey, ".xtp", 0, REG_SZ, (CONST BYTE *)cp, len);
    RegCloseKey(hKey);

    //
    // Add isapi_srun.dll to the LoadLibrary list (unless already there).
    //
    hKey = reg_lookup(HKEY_LOCAL_MACHINE, ROOT_KEY);
    if(hKey == 0)
        return "Can't find WebSite root data in registry";
    if(reg_query_string(hKey, "LoadLibrary", buf) == 0)
        return 0;
    if(strstr(buf, "isapi_srun.dll") == NULL)			// If not already appended
    {
        if(buf[0] != '\0')								// If existing LoadLibrary stuff
            strcat(buf, ";");							// Insert delimiter
        strcat(buf, dst_name);
        RegSetValueEx(hKey, "LoadLibrary", 0, REG_SZ, (CONST BYTE *)buf, (strlen(buf) + 1));
    }
    RegCloseKey(hKey);

    return 0;
}