diff options
author | Rich Megginson <rmeggins@redhat.com> | 2005-03-05 23:55:10 +0000 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2005-03-05 23:55:10 +0000 |
commit | 454c5dcf11a5fc41f5dc2bf280fec167d686bcdf (patch) | |
tree | d49919bc71616a454dbc37287bfce0a563ddda51 /ldap/cm/newinstnt | |
parent | a71ecb02bafbb303b35bae0bca6383fce30b8c21 (diff) | |
download | ds-454c5dcf11a5fc41f5dc2bf280fec167d686bcdf.tar.gz ds-454c5dcf11a5fc41f5dc2bf280fec167d686bcdf.tar.xz ds-454c5dcf11a5fc41f5dc2bf280fec167d686bcdf.zip |
fix Windows build - use local functions instead of NSPR - fix compiler warnings
Diffstat (limited to 'ldap/cm/newinstnt')
-rw-r--r-- | ldap/cm/newinstnt/dsinst.c | 162 |
1 files changed, 90 insertions, 72 deletions
diff --git a/ldap/cm/newinstnt/dsinst.c b/ldap/cm/newinstnt/dsinst.c index a2247056..91491dcc 100644 --- a/ldap/cm/newinstnt/dsinst.c +++ b/ldap/cm/newinstnt/dsinst.c @@ -60,6 +60,20 @@ static char *dialogMessage; /* used by shutdownDialogProc */ #define OLD_VERSION_SIZE 32 static char oldVersion[OLD_VERSION_SIZE]; /* used by reinstall */ +static int +my_snprintf(char *s, size_t size, const char *fmt, ...) +{ + int rc; + va_list ap; + + va_start(ap, s); + rc = _vsnprintf(s, size, fmt, ap); + va_end(ap); + s[size-1] = (char)0; + + return rc; +} + static void storeUserDirectoryInfo() { @@ -86,7 +100,7 @@ storeUserDirectoryInfo() lstrcpy(mi.m_szUserGroupAdminPW, mi.m_szInstancePassword); } - PR_snprintf(mi.m_szUserGroupURL, sizeof(mi.m_szUserGroupURL), "ldap://%s:%d/%s", mi.m_szInstanceHostName, + my_snprintf(mi.m_szUserGroupURL, sizeof(mi.m_szUserGroupURL), "ldap://%s:%d/%s", mi.m_szInstanceHostName, mi.m_nInstanceServerPort, mi.m_szInstanceSuffix); } @@ -232,7 +246,7 @@ IsValidAdminDomain( int status = FALSE; Ldap *ldap = NULL; - PR_snprintf(ldapurl, sizeof(ldapurl), "ldap://%s:%d/%s", host, port, suffix); + my_snprintf(ldapurl, sizeof(ldapurl), "ldap://%s:%d/%s", host, port, suffix); if (createLdap(&ldap, ldapurl, binddn, binddnpwd, 0, 0) == OKAY) { LdapEntry *le = createLdapEntry(ldap); @@ -590,7 +604,7 @@ void getAdminServInfo() GetEnvironmentVariable("TEMP", szTempDir, sizeof(szTempDir)); - PR_snprintf(szCacheFile, sizeof(szCacheFile), "%s\\install.inf", szTempDir); + my_snprintf(szCacheFile, sizeof(szCacheFile), "%s\\install.inf", szTempDir); mi.m_nAdminServerPort = GetPrivateProfileInt(pszAdminSection, SLAPD_KEY_ADMIN_SERVER_PORT, -1, szCacheFile); @@ -616,14 +630,14 @@ BOOL writeINFfile(const char *filename) szAdminDN = formAdminDomainDN(mi.m_szAdminDomain); if (szAdminDN) { - PR_snprintf(mi.m_szInstallDN, sizeof(mi.m_szInstallDN), szAdminDN); + my_snprintf(mi.m_szInstallDN, sizeof(mi.m_szInstallDN), szAdminDN); nsSetupFree(szAdminDN); } else { //note probably should fail. LogData(NULL, "Warning: Slapd unable to Form Admin Domain, guessing"); - PR_snprintf(mi.m_szInstallDN, sizeof(mi.m_szInstallDN), "ou=%s, o=NetscapeRoot", mi.m_szAdminDomain); + my_snprintf(mi.m_szInstallDN, sizeof(mi.m_szInstallDN), "ou=%s, o=NetscapeRoot", mi.m_szAdminDomain); } } @@ -775,9 +789,11 @@ BOOL isValidServerID(char *pszServerIdentifier) /* for now just check registry to see if this server ID exists, in future add might want to add more sanity checks */ - fullId = PR_smprintf("%s-%s", DS_ID_SERVICE, pszServerIdentifier); + size_t len = strlen(DS_ID_SERVICE) + strlen(pszServerIdentifier) + 2; + fullId = malloc(len); + sprintf(fullId, "%s-%s", DS_ID_SERVICE, pszServerIdentifier); - PR_snprintf(line, sizeof(line), "%s\\%s", KEY_SERVICES, fullId); + my_snprintf(line, sizeof(line), "%s\\%s", KEY_SERVICES, fullId); Result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, line, @@ -796,7 +812,7 @@ BOOL isValidServerID(char *pszServerIdentifier) } - PR_smprintf_free(fullId); + free(fullId); } return bRC; @@ -840,21 +856,21 @@ int set_default_ldap_settings() /* default admin domain is also derived from the FQDN */ ++i; - PR_snprintf(mi.m_szAdminDomain, sizeof(mi.m_szAdminDomain), "%s", mi.m_szInstanceHostName+i); + my_snprintf(mi.m_szAdminDomain, sizeof(mi.m_szAdminDomain), "%s", mi.m_szInstanceHostName+i); mi.m_nInstanceServerPort=DEFAULT_SERVER_PORT; - PR_snprintf(mi.m_szInstanceUnrestrictedUser, sizeof(mi.m_szInstanceUnrestrictedUser), DEFAULT_UNRESTRICTED_USER); + my_snprintf(mi.m_szInstanceUnrestrictedUser, sizeof(mi.m_szInstanceUnrestrictedUser), DEFAULT_UNRESTRICTED_USER); mi.m_nCfgSspt = DEFAULT_CONFIG_SSPT; - PR_snprintf(mi.m_szSsptUid, sizeof(mi.m_szSsptUid), DEFAULT_SSPT_USER); + my_snprintf(mi.m_szSsptUid, sizeof(mi.m_szSsptUid), DEFAULT_SSPT_USER); /* stevross: don't want default for these in silent mode, user must specify them */ if( SILENTMODE != MODE) { - PR_snprintf(mi.m_szSupplierDN, sizeof(mi.m_szSupplierDN), DEFAULT_SUPPLIER_DN); - PR_snprintf(mi.m_szChangeLogSuffix, sizeof(mi.m_szChangeLogSuffix), DEFAULT_CHANGELOGSUFFIX); + my_snprintf(mi.m_szSupplierDN, sizeof(mi.m_szSupplierDN), DEFAULT_SUPPLIER_DN); + my_snprintf(mi.m_szChangeLogSuffix, sizeof(mi.m_szChangeLogSuffix), DEFAULT_CHANGELOGSUFFIX); } @@ -885,7 +901,7 @@ int set_default_ldap_settings() mi.m_nMCCPort=DEFAULT_SERVER_PORT; mi.m_szMCCBindAs = malloc(MAX_STR_SIZE); - PR_snprintf(mi.m_szMCCBindAs, sizeof(mi.m_szMCCBindAs), "%s", DEFAULT_SSPT_USER); + my_snprintf(mi.m_szMCCBindAs, sizeof(mi.m_szMCCBindAs), "%s", DEFAULT_SSPT_USER); lstrcpy(mi.m_szUGSuffix, mi.m_szInstanceSuffix); mi.m_nUGPort=DEFAULT_SERVER_PORT; @@ -948,7 +964,7 @@ void set_ldap_settings() lstrcpy(mi.m_szMCCHost, mi.m_szInstanceHostName); mi.m_nMCCPort = mi.m_nInstanceServerPort; lstrcpy(mi.m_szMCCSuffix, NS_DOMAIN_ROOT); - PR_snprintf(mi.m_szMCCBindAs, sizeof(mi.m_szMCCBindAs), "%s", mi.m_szSsptUid); + my_snprintf(mi.m_szMCCBindAs, sizeof(mi.m_szMCCBindAs), "%s", mi.m_szSsptUid); lstrcpy(mi.m_szMCCPw, mi.m_szSsptUidPw); } @@ -2227,7 +2243,7 @@ BOOL Verify_UG_Settings() { /* all settings good */ /* set UG LDAP URL */ - PR_snprintf(mi.m_szUserGroupURL, sizeof(mi.m_szUserGroupURL), "ldap://%s:%d/%s", + my_snprintf(mi.m_szUserGroupURL, sizeof(mi.m_szUserGroupURL), "ldap://%s:%d/%s", mi.m_szUGHost, mi.m_nUGPort, mi.m_szUGSuffix); } } @@ -3958,7 +3974,7 @@ Supplier_Replication_DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l // and wm_init is called again if( !nInitialized ) { - PR_snprintf(mi.m_szChangeLogDbDir, sizeof(mi.m_szChangeLogDbDir),"%s\\%s-%s\\%s", TARGETDIR, + my_snprintf(mi.m_szChangeLogDbDir, sizeof(mi.m_szChangeLogDbDir),"%s\\%s-%s\\%s", TARGETDIR, DS_ID_SERVICE, mi.m_szServerIdentifier, DEFAULT_CHANGELOGDIR); nInitialized = 1; } @@ -4194,7 +4210,7 @@ Consumer_DN_DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) // you can perform any one time initialization that you require. Setup8bitInputDisplay(hwndDlg, h8bitControls); - PR_snprintf(mi.m_szConsumerDN, sizeof(mi.m_szConsumerDN), "%s,%s", DEFAULT_CONSUMER_DN, mi.m_szInstanceSuffix); + my_snprintf(mi.m_szConsumerDN, sizeof(mi.m_szConsumerDN), "%s,%s", DEFAULT_CONSUMER_DN, mi.m_szInstanceSuffix); break; @@ -5093,7 +5109,7 @@ Sample_Entries_Org_DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa /* assume by browsing user will want this file so check custom radio button for them and set file to be displayed */ - PR_snprintf(mi.m_szPopLdifFile, sizeof(mi.m_szPopLdifFile), "%s", szCustomFileName); + my_snprintf(mi.m_szPopLdifFile, sizeof(mi.m_szPopLdifFile), "%s", szCustomFileName); CheckRadioButton(hwndDlg, IDC_RADIO_DONT_POPULATE, IDC_RADIO_POPULATE_CUSTOM, IDC_RADIO_POPULATE_CUSTOM); default: @@ -5103,14 +5119,14 @@ Sample_Entries_Org_DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if( BST_CHECKED == IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPULATE_SAMPLE ) ) { mi.m_nPopulateSampleEntries = 1; - PR_snprintf(mi.m_szPopLdifFile, sizeof(mi.m_szPopLdifFile), "%s", szSampleFileName); + my_snprintf(mi.m_szPopLdifFile, sizeof(mi.m_szPopLdifFile), "%s", szSampleFileName); }else if( BST_CHECKED == IsDlgButtonChecked(hwndDlg, IDC_RADIO_POPULATE_CUSTOM ) ){ mi.m_nPopulateSampleEntries = 0; mi.m_nPopulateSampleOrg = 1; -// PR_snprintf(mi.m_szPopLdifFile, sizeof(mi.m_szPopLdifFile), "%s", szCustomFileName); +// my_snprintf(mi.m_szPopLdifFile, sizeof(mi.m_szPopLdifFile), "%s", szCustomFileName); }else{ mi.m_nPopulateSampleEntries = 0; - PR_snprintf(mi.m_szPopLdifFile, sizeof(mi.m_szPopLdifFile), "\0"); + my_snprintf(mi.m_szPopLdifFile, sizeof(mi.m_szPopLdifFile), "\0"); } @@ -5155,9 +5171,9 @@ Sample_Entries_Org_DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } /* warn user about suffix and database import */ - PR_snprintf(szMustHaveBase, sizeof(szMustHaveBase), "(note: must have base %s)", mi.m_szInstanceSuffix ); + my_snprintf(szMustHaveBase, sizeof(szMustHaveBase), "(note: must have base %s)", mi.m_szInstanceSuffix ); SetDlgItemText(hwndDlg, IDC_STATIC_MUST_HAVE_BASE, szMustHaveBase); - PR_snprintf(szSampleFileName, sizeof(szSampleFileName), "%s\\%s", TARGETDIR, SAMPLE_LDIF); + my_snprintf(szSampleFileName, sizeof(szSampleFileName), "%s\\%s", TARGETDIR, SAMPLE_LDIF); if(mi.m_nExistingUG == 0) { @@ -5706,7 +5722,7 @@ DSINST_PreInstall(LPCSTR lpszInstallPath) if (mi.m_nReInstall) { char infFile[MAX_PATH] = {0}; - PR_snprintf(infFile, sizeof(infFile), "%s\\setup\\slapd\\slapd.inf", TARGETDIR); + my_snprintf(infFile, sizeof(infFile), "%s\\setup\\slapd\\slapd.inf", TARGETDIR); GetProductInfoStringWithTok(SETUP_INF_VERSION, "=", oldVersion, OLD_VERSION_SIZE, infFile); myLogData("file %s old version is %s", infFile, oldVersion); @@ -6056,7 +6072,7 @@ DSINST_WriteGlobalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName) /* construct the LDAPURL */ /* suffix must always be o=netscape root */ - PR_snprintf(mi.m_szLdapURL, sizeof(mi.m_szLdapURL), "ldap://%s:%d/%s", mi.m_szMCCHost, mi.m_nMCCPort, NS_DOMAIN_ROOT); + my_snprintf(mi.m_szLdapURL, sizeof(mi.m_szLdapURL), "ldap://%s:%d/%s", mi.m_szMCCHost, mi.m_nMCCPort, NS_DOMAIN_ROOT); if(mi.m_nExistingUG == 0) { @@ -6079,7 +6095,7 @@ DSINST_WriteGlobalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName) lstrcpy(mi.m_szUserGroupAdminPW, mi.m_szInstancePassword); } - PR_snprintf(mi.m_szUserGroupURL, sizeof(mi.m_szUserGroupURL), "ldap://%s:%d/%s", mi.m_szInstanceHostName, + my_snprintf(mi.m_szUserGroupURL, sizeof(mi.m_szUserGroupURL), "ldap://%s:%d/%s", mi.m_szInstanceHostName, mi.m_nInstanceServerPort, mi.m_szInstanceSuffix); } @@ -6147,7 +6163,7 @@ DSINST_WriteLocalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName) WritePrivateProfileString(lpszSectionName, SLAPD_KEY_USE_EXISTING_UG, onezero2yesno(mi.m_nExistingUG), lpszCacheFileName); - PR_snprintf(szInt, sizeof(szInt), "%d", mi.m_nInstanceServerPort); + my_snprintf(szInt, sizeof(szInt), "%d", mi.m_nInstanceServerPort); WritePrivateProfileString(lpszSectionName, SLAPD_KEY_SERVER_PORT, szInt, lpszCacheFileName); @@ -6178,7 +6194,7 @@ DSINST_WriteLocalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName) WritePrivateProfileString(lpszSectionName, SLAPD_KEY_ADD_ORG_ENTRIES, onezero2yesno(mi.m_nPopulateSampleOrg), lpszCacheFileName); - PR_snprintf(szInt, sizeof(szInt), "%s", onezero2yesno( ( (NO_REPLICATION != mi.m_nSetupConsumerReplication) || (NO_REPLICATION != mi.m_nSetupSupplierReplication) ) ) ); + my_snprintf(szInt, sizeof(szInt), "%s", onezero2yesno( ( (NO_REPLICATION != mi.m_nSetupConsumerReplication) || (NO_REPLICATION != mi.m_nSetupSupplierReplication) ) ) ); WritePrivateProfileString(lpszSectionName, SLAPD_KEY_USE_REPLICATION, szInt, lpszCacheFileName); @@ -6187,9 +6203,9 @@ DSINST_WriteLocalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName) /* write no instead of number for no replication to be like unix installer */ if(NO_REPLICATION != mi.m_nSetupConsumerReplication) { - PR_snprintf(szInt, sizeof(szInt), "%d", mi.m_nSetupConsumerReplication); + my_snprintf(szInt, sizeof(szInt), "%d", mi.m_nSetupConsumerReplication); }else{ - PR_snprintf(szInt, sizeof(szInt), "no"); + my_snprintf(szInt, sizeof(szInt), "no"); } WritePrivateProfileString(lpszSectionName, SLAPD_KEY_SETUP_CONSUMER, szInt, @@ -6198,7 +6214,7 @@ DSINST_WriteLocalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName) WritePrivateProfileString(lpszSectionName, SLAPD_KEY_CIR_HOST, mi.m_szConsumerHost, lpszCacheFileName); - PR_snprintf(szInt, sizeof(szInt), "%d", mi.m_nConsumerPort ); + my_snprintf(szInt, sizeof(szInt), "%d", mi.m_nConsumerPort ); WritePrivateProfileString(lpszSectionName, SLAPD_KEY_CIR_PORT, szInt, lpszCacheFileName); @@ -6214,7 +6230,7 @@ DSINST_WriteLocalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName) WritePrivateProfileString(lpszSectionName, SLAPD_KEY_CIR_SECURITY_ON, onezero2yesno(mi.m_nConsumerSSL), lpszCacheFileName); - PR_snprintf(szInt, sizeof(szInt), "%d", mi.m_nCIRInterval ); + my_snprintf(szInt, sizeof(szInt), "%d", mi.m_nCIRInterval ); WritePrivateProfileString(lpszSectionName, SLAPD_KEY_CIR_INTERVAL, szInt, lpszCacheFileName); @@ -6249,9 +6265,9 @@ DSINST_WriteLocalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName) /* write no instead of number for no replication to be like unix installer */ if(NO_REPLICATION != mi.m_nSetupSupplierReplication) { - PR_snprintf(szInt, sizeof(szInt), "%d", mi.m_nSetupSupplierReplication); + my_snprintf(szInt, sizeof(szInt), "%d", mi.m_nSetupSupplierReplication); }else{ - PR_snprintf(szInt, sizeof(szInt), "no"); + my_snprintf(szInt, sizeof(szInt), "no"); } WritePrivateProfileString(lpszSectionName, SLAPD_KEY_SETUP_SUPPLIER, szInt, lpszCacheFileName); @@ -6265,7 +6281,7 @@ DSINST_WriteLocalCache(LPCSTR lpszCacheFileName, LPCSTR lpszSectionName) WritePrivateProfileString(lpszSectionName, SLAPD_KEY_SIR_HOST, mi.m_szSupplierHost, lpszCacheFileName); - PR_snprintf(szInt, sizeof(szInt), "%d", mi.m_nSupplierPort ); + my_snprintf(szInt, sizeof(szInt), "%d", mi.m_nSupplierPort ); WritePrivateProfileString(lpszSectionName, SLAPD_KEY_SIR_PORT, szInt, lpszCacheFileName); @@ -6893,12 +6909,12 @@ run_cgi(const char *serverroot, const char *cgipath, const char *args) char netsiteRootEnvVar[MAX_STR_SIZE] = {0}; LPVOID lpMsgBuf; - PR_snprintf(netsiteRootEnvVar, sizeof(netsiteRootEnvVar), "NETSITE_ROOT=%s", serverroot); + my_snprintf(netsiteRootEnvVar, sizeof(netsiteRootEnvVar), "NETSITE_ROOT=%s", serverroot); _putenv(netsiteRootEnvVar); if ( getenv("DEBUG_DSINST") ) DebugBreak(); /* everything is set, start the program */ - PR_snprintf(prog, sizeof(prog), "%s\\%s", serverroot, cgipath); + my_snprintf(prog, sizeof(prog), "%s\\%s", serverroot, cgipath); if (!FileExists(prog)) { lpMsgBuf = getLastErrorMessage(); @@ -6913,7 +6929,7 @@ run_cgi(const char *serverroot, const char *cgipath, const char *args) } else { - PR_snprintf(cmdLine, sizeof(cmdLine), "\"%s\" %s", prog, args); + my_snprintf(cmdLine, sizeof(cmdLine), "\"%s\" %s", prog, args); myLogData("run_cgi: before execution of %s", cmdLine); if ( (procResult = _LaunchAndWait(cmdLine, INFINITE)) != 0) @@ -6968,7 +6984,7 @@ create_slapd_instance(const char *hostname, const char *serverroot) /* create an .inf file to pass to index */ /* write the data to a temp file */ - PR_snprintf(INFfile, sizeof(INFfile), "%s\\temp%d.inf", TEMPDIR, _getpid()); + my_snprintf(INFfile, sizeof(INFfile), "%s\\temp%d.inf", TEMPDIR, _getpid()); myLogData("create_slapd_instance: inf file is %s", INFfile); if (TRUE == (status = writeINFfile(INFfile)) ) @@ -6984,9 +7000,9 @@ create_slapd_instance(const char *hostname, const char *serverroot) else { /* set temp file for admin output */ - PR_snprintf(debugFile, sizeof(debugFile), "DEBUG_FILE=%s\\debug.%d", TEMPDIR, _getpid()); + my_snprintf(debugFile, sizeof(debugFile), "DEBUG_FILE=%s\\debug.%d", TEMPDIR, _getpid()); _putenv(debugFile); - PR_snprintf(szCGIArgs, sizeof(szCGIArgs), "\"%s\\bin\\slapd\\admin\\bin\\Install.pl\"", + my_snprintf(szCGIArgs, sizeof(szCGIArgs), "\"%s\\bin\\slapd\\admin\\bin\\Install.pl\"", serverroot); if (mi.m_nReInstall) { @@ -7033,7 +7049,7 @@ int generate_mcc_bat() return rc; } - PR_snprintf(szFilename, sizeof(szFilename), "%s\\%s-%s\\mcc.bat", TARGETDIR, DS_ID_SERVICE, + my_snprintf(szFilename, sizeof(szFilename), "%s\\%s-%s\\mcc.bat", TARGETDIR, DS_ID_SERVICE, mi.m_szServerIdentifier); fp = fopen(szFilename, "wb"); if (!fp) @@ -7042,7 +7058,7 @@ int generate_mcc_bat() ERR_NO_CREATE_FILE, 0, szFilename); rc = -1; }else{ - PR_snprintf(szJavaDir, sizeof(szJavaDir), "%s\\java", TARGETDIR); + my_snprintf(szJavaDir, sizeof(szJavaDir), "%s\\java", TARGETDIR); fprintf(fp, "pushd \"%s\"\n", szJavaDir); @@ -7090,7 +7106,7 @@ int generate_install_ldapctrs_bat() CHAR szFilename[MAX_STR_SIZE]; INT rc = 0; - PR_snprintf(szFilename, sizeof(szFilename), "%s\\%s", TARGETDIR, INSTALL_CTRS_BAT); + my_snprintf(szFilename, sizeof(szFilename), "%s\\%s", TARGETDIR, INSTALL_CTRS_BAT); fp = fopen(szFilename, "wb"); if (!fp) { @@ -7286,7 +7302,7 @@ updateRegistryKeys(const char *oldVersion, const char *newVersion) // the first place is under // HKEY_LOCAL_MACHINE\SOFTWARE\Netscape\Directory\oldVersion // we need to change oldVersion to newVersion - PR_snprintf(newKey, sizeof(newKey), "%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT); + my_snprintf(newKey, sizeof(newKey), "%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT); strcpy(oldKey, newKey); if (ptr = strstr(oldKey, SVR_VERSION)) { strncpy(ptr, oldVersion, strlen(oldVersion)); @@ -7300,9 +7316,9 @@ updateRegistryKeys(const char *oldVersion, const char *newVersion) // the second place is under // HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\slapdoldVersoin // we need to change oldVersion to newVersion - PR_snprintf(oldKey, sizeof(oldKey), "%s\\%s%s", KEY_SERVICES, PRODUCT_NAME, + my_snprintf(oldKey, sizeof(oldKey), "%s\\%s%s", KEY_SERVICES, PRODUCT_NAME, oldVersion); - PR_snprintf(newKey, sizeof(newKey), "%s\\%s%s", KEY_SERVICES, PRODUCT_NAME, + my_snprintf(newKey, sizeof(newKey), "%s\\%s%s", KEY_SERVICES, PRODUCT_NAME, SVR_VERSION); CopyAndDeleteKey(HKEY_LOCAL_MACHINE, oldKey, HKEY_LOCAL_MACHINE, @@ -7402,7 +7418,7 @@ NSPERLINST_PostInstall(VOID) // hack to work around potential bug in setupsdk . . . SetCurrentDirectory("../slapd"); - PR_snprintf(infFile, sizeof(infFile), "slapd.inf"); + my_snprintf(infFile, sizeof(infFile), "slapd.inf"); GetProductInfoStringWithTok(NSPERL_POST_INSTALL_PROG, "=", nsPerlPostInstall, BUFSIZ, infFile); @@ -7419,7 +7435,7 @@ NSPERLINST_PostInstall(VOID) // get the RunPostInstall attribute from the inf; this is the name // of the post install program *p = 0; // p points at last dir sep in the path, so null it - PR_snprintf(instDir, sizeof(instDir), "%s\\%s", TARGETDIR, nsPerlPostInstall); + my_snprintf(instDir, sizeof(instDir), "%s\\%s", TARGETDIR, nsPerlPostInstall); p++; // change directory to the directory of the post install program and @@ -7440,8 +7456,8 @@ NSPERLINST_PostInstall(VOID) SetCurrentDirectory(szCurrentDir); - PR_snprintf(srcPath, sizeof(srcPath), "%s\\nsperl.exe", instDir); - PR_snprintf(destPath, sizeof(destPath), "%s\\%s", TARGETDIR, PERL_EXE); + my_snprintf(srcPath, sizeof(srcPath), "%s\\nsperl.exe", instDir); + my_snprintf(destPath, sizeof(destPath), "%s\\%s", TARGETDIR, PERL_EXE); if (FALSE == CopyFile(srcPath, destPath, FALSE)) { // FALSE to overwrite file if exists myLogError("NSPERLINST_PostInstall: could not copy file %s to %s", @@ -7543,7 +7559,7 @@ static BOOL RemoveSNMPValue(void) DWORD sizeof_value_data_buffer; /* open registry key for Microsoft SNMP service */ - PR_snprintf(line, sizeof(line), "%s\\%s", KEY_SERVICES, KEY_SNMP_SERVICE); + my_snprintf(line, sizeof(line), "%s\\%s", KEY_SERVICES, KEY_SNMP_SERVICE); Result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, line, 0, @@ -7554,7 +7570,7 @@ static BOOL RemoveSNMPValue(void) for slapd snmp value to remove */ if (Result == ERROR_SUCCESS) { - PR_snprintf(line, sizeof(line), + my_snprintf(line, sizeof(line), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT, @@ -7573,7 +7589,7 @@ static BOOL RemoveSNMPValue(void) for(iterator = 0; iterator <= NumValues; iterator++) { sizeof_value_data_buffer=MAX_PATH; - PR_snprintf(NumValuesBuf, sizeof(NumValuesBuf), "%d", iterator); + my_snprintf(NumValuesBuf, sizeof(NumValuesBuf), "%d", iterator); Result = RegQueryValueEx(hServerKey, NumValuesBuf, NULL, @@ -7603,13 +7619,13 @@ BOOL RemoveSNMPKeys(void) /* open registry key for Directory SNMP s */ memset(line, '\0', MAX_PATH); - PR_snprintf(line, sizeof(line), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT, + my_snprintf(line, sizeof(line), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT, KEY_SNMP_CURRENTVERSION); RegDeleteKey(HKEY_LOCAL_MACHINE, line); memset(line, '\0', MAX_PATH); - PR_snprintf(line, sizeof(line), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT, + my_snprintf(line, sizeof(line), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT, SNMP_SERVICE_NAME); RegDeleteKey(HKEY_LOCAL_MACHINE, line); @@ -7645,7 +7661,7 @@ BOOL RemoveDirectoryRootKey() BOOL bRC = TRUE; memset(line, '\0', MAX_PATH); - PR_snprintf(line, sizeof(line), "%s\\%s", KEY_SOFTWARE_NETSCAPE, DS_NAME_SHORT); + my_snprintf(line, sizeof(line), "%s\\%s", KEY_SOFTWARE_NETSCAPE, DS_NAME_SHORT); RegDeleteKey(HKEY_LOCAL_MACHINE, line); @@ -7806,7 +7822,7 @@ void ControlSlapdInstance(char *pszServiceName, BOOL bOn) LoadString( mi.m_hModule, IDS_STOPPING_SERVICE, szFormat, MAX_STR_SIZE); } - PR_snprintf(szMessage, sizeof(szMessage), szFormat, shortName); + my_snprintf(szMessage, sizeof(szMessage), szFormat, shortName); myLogData(szMessage); ZeroMemory(&shutdownargs, sizeof(shutdownargs)); @@ -7820,7 +7836,7 @@ void ControlSlapdInstance(char *pszServiceName, BOOL bOn) && (bOn != (bServerRunning = isServiceRunning( pszServiceName ) ) ) ) { /* try to turn of the server */ - PR_snprintf(szLog, sizeof(szLog), szMessage); + my_snprintf(szLog, sizeof(szLog), szMessage); LogData(NULL, szLog); myLogData(szLog); @@ -7841,7 +7857,7 @@ void ControlSlapdInstance(char *pszServiceName, BOOL bOn) LoadString( mi.m_hModule, IDS_WAIT_SERVICE_STOP, szFormat, MAX_STR_SIZE); } - PR_snprintf(szLog, sizeof(szLog), szFormat, shortName); + my_snprintf(szLog, sizeof(szLog), szFormat, shortName); LogData(NULL, szLog); myLogData(szLog); @@ -7898,7 +7914,7 @@ static void ConvertPasswordToPin(char *pszServerRoot, char *pszServiceName) return; } /* have to be in the alias directory to run this */ - PR_snprintf(szNewDir, sizeof(szNewDir), "%s\\alias", pszServerRoot); + my_snprintf(szNewDir, sizeof(szNewDir), "%s\\alias", pszServerRoot); /* change current dir to the alias directory */ if (SetCurrentDirectory(szNewDir) == 0) { @@ -7908,7 +7924,7 @@ static void ConvertPasswordToPin(char *pszServerRoot, char *pszServiceName) } /* spawn the perl script which does the conversion */ - PR_snprintf(szFormat, sizeof(szFormat), "\"%s\\bin\\slapd\\admin\\bin\\migratePwdFile\" \"%s\" %s", + my_snprintf(szFormat, sizeof(szFormat), "\"%s\\bin\\slapd\\admin\\bin\\migratePwdFile\" \"%s\" %s", pszServerRoot, pszServerRoot, pszServiceName); run_cgi(pszServerRoot, PERL_EXE, szFormat); @@ -7945,7 +7961,7 @@ static void ReinstallUpgradeServer(char *pszServerRoot, char *pszServiceName) } /* spawn the perl script which does the conversion */ - PR_snprintf(szFormat, sizeof(szFormat), "\"%s\\bin\\slapd\\admin\\bin\\upgradeServer\" \"%s\" %s", + my_snprintf(szFormat, sizeof(szFormat), "\"%s\\bin\\slapd\\admin\\bin\\upgradeServer\" \"%s\" %s", pszServerRoot, pszServerRoot, pszServiceName); run_cgi(pszServerRoot, PERL_EXE, szFormat); @@ -7972,9 +7988,9 @@ BOOL RemoveSlapdInstance(LPCSTR pszServerRoot, char *pszServiceName) /* now try to remove the instance */ /* call remove cgi with inf */ - PR_snprintf(szINFfile, sizeof(szINFfile), "%s/unin%d.inf", TEMPDIR, _getpid()); + my_snprintf(szINFfile, sizeof(szINFfile), "%s/unin%d.inf", TEMPDIR, _getpid()); writeUninstINFfile( szINFfile, pszServerRoot, pszServiceName); - PR_snprintf(szCGIArgs, sizeof(szCGIArgs), " -f \"%s\"", szINFfile); + my_snprintf(szCGIArgs, sizeof(szCGIArgs), " -f \"%s\"", szINFfile); /* remove this instance */ status = run_cgi(pszServerRoot, "bin\\slapd\\admin\\bin\\ds_remove.exe", szCGIArgs); @@ -8025,7 +8041,7 @@ BOOL RemoveMiscSlapdFiles(pszServerRoot) for(i=0; miscFilesList[i] != NULL; i++) { memset(szFileName, '\0', MAX_STR_SIZE); - PR_snprintf(szFileName, sizeof(szFileName), "%s\\%s", pszServerRoot, miscFilesList[i] ); + my_snprintf(szFileName, sizeof(szFileName), "%s\\%s", pszServerRoot, miscFilesList[i] ); DeleteRecursively(szFileName); } @@ -8200,7 +8216,7 @@ fixURL(char *url) char base[MAX_STR_SIZE]; GetURLComponents(url, host, &port, base); fixDN(base); - sprintf(url, "ldap://%s:%d/%s", host, port, base); + my_snprintf(url, MAX_STR_SIZE, "ldap://%s:%d/%s", host, port, base); } } @@ -8246,8 +8262,9 @@ DSMessageBox(UINT type, UINT titleKey, UINT msgKey, const char *titlearg, ...) LoadString(mi.m_hModule, titleKey, titleFormat, MAX_STR_SIZE); va_start(ap, titlearg); - PR_vsnprintf(msg, sizeof(msg), msgFormat, ap); + _vsnprintf(msg, sizeof(msg), msgFormat, ap); va_end(ap); + msg[sizeof(msg)-1] = (char)0; LogData(NULL, msg); myLogData(msg); @@ -8255,7 +8272,7 @@ DSMessageBox(UINT type, UINT titleKey, UINT msgKey, const char *titlearg, ...) { if (titleFormat[0]) { - PR_snprintf(title, sizeof(title), titleFormat, titlearg); + my_snprintf(title, sizeof(title), titleFormat, titlearg); retval = NsSetupMessageBox(NULL, msg, title, type); } else @@ -8291,15 +8308,16 @@ DSMessageBoxOK(UINT titleKey, UINT msgKey, const char *titlearg, ...) LoadString(mi.m_hModule, titleKey, titleFormat, MAX_STR_SIZE); va_start(ap, titlearg); - PR_vsnprintf(msg, sizeof(msg), msgFormat, ap); + _vsnprintf(msg, sizeof(msg), msgFormat, ap); va_end(ap); + msg[sizeof(msg)-1] = (char)0; LogData(NULL, msg); if (MODE != SILENTMODE) { if (titleFormat[0]) { - PR_snprintf(title, sizeof(title), titleFormat, titlearg); + my_snprintf(title, sizeof(title), titleFormat, titlearg); retval = NsSetupMessageBox(NULL, msg, title, MB_OK); } else |