summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Only check modrdn ops for backend/suffix correctness if not the default backenddatainteropRich Megginson2010-09-131-2/+3
| | | | | | | | | | | | | | The function slapi_mapping_tree_select_and_check() is only called for modrdn operations, to make sure we are not attempting to rename a suffix or move an entry from one backend to another. This defeats datainterop plugins that may want to perform some other operation in these cases. If the target suffix/backend is not found, the default backend is used. If the default backend is being used, don't check for all errors, just allow the operation to pass through to the preop plugins. Need to make sure this doesn't cause problems if 1) null suffix is not used - entry really is bogus or doesn't exist 2) null suffix is being used but entry belongs to another null suffix or is really bogus
* Bug 633168 - Share backend dbEnv with the replication changelogNoriko Hosoi2010-09-131-0/+29
| | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=633168 Description: previous commit was missing the upgrade script 81changelog.pl
* Bug 633168 - Share backend dbEnv with the replication changelogNoriko Hosoi2010-09-1336-33159/+21782
| | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=633168 Description: * cl5_api.c, cl5_api.h - fetches dbEnv from backend using slapi_back_get_info. - unused macros and DB helper functions and APIs are removed. * cl5_config.c - local changelog DB related config parameters are removed. * Added SLAPI_PLUGIN_BE_PRE_CLOSE_FN and SLAPI_PLUGIN_BE_POST_OPEN_FN to close changelog DB before dbEnv is closed and to open changelog DB after dbEnv is opened, respectively. * Added slapi APIs slapi_back_get_info and slapi_back_set_info to get/set the backend info. * back-ldbm - db2bak[.pl] and bak2db[.pl] backs up and restores the database files including changelog db. - changelog dir is backed up in <backupdir>/.repl_changelog_backup. - underlying implementation ldbm_back_get_info for slapi_back_get_info is added. * Added an upgrade script 81changelog.pl See also: http://directory.fedoraproject.org/wiki/Move_changelog
* agmtlist_shutdown (repl5_agmtlist.c) had an illegal access defect.Noriko Hosoi2010-09-131-3/+5
| | | | | | | Object ro is freed in objset_next_obj and next object is returned if any. After ro is released, it was used to get agreement data. This patch moves the location of objset_next_obj after the agreement data is retrieved.
* Bug 630091 - (cov#15582) Free of uninitialized pointer in attr_index_config()Nathan Kinder2010-09-131-1/+1
| | | | | | In attr_index_config(), if argc or argv are NULL, we jump to the done label. We then try to free attrs, but it was never initialized. We need to initialize attrs to NULL.
* Bug 630091 - (cov#15519) Initialize bervals in search_easter_egg()Nathan Kinder2010-09-131-2/+2
| | | | | In search_easter_egg(), we need to initialize the bervals before we pass them to slapi_ldif_parse_line().
* Bug 630091 - (cov#15516,15517) Initialize pointers before attempting to freeNathan Kinder2010-09-131-1/+2
| | | | | | | | If we encounter an error early in ldbm_instance_index_config_modify_callback(), we jump to the out label where we try to free origMatchingRules, but it may not be initialized. The same is true for origIndexTypes. We need to initialize these pointers to NULL.
* Bug 630091 - (cov#15515) Use of uninitialized array in index config codeNathan Kinder2010-09-131-1/+1
| | | | | | | | If we encounter an error early in ldbm_instance_index_config_modify_callback(), we jump to the out label where we free each element of the arglist array. This can happen without initializing the array. We need to initialize arglist before there is any chance to jump to the out label.
* Bug 630091 - (cov#15514) Initialize DBT in entryrdn_get_parent()Nathan Kinder2010-09-131-1/+3
| | | | | | | | In entryrdn_get_parent(), there is a DBT structure that we can use without initializing. If we goto the bail label, we try to free data.data, but data was never initialized. We should clear the memory used by data in the beginning of the function before we have an opportunity to goto bail.
* Bug 630091 - (cov#15513) Fix usage of uninitialized bervalsNathan Kinder2010-09-131-1/+2
| | | | | | We use some uninitialized bervals when the backend code calls slapi_ldif_parse_line(). We should be initializing the bervals to be empty.
* Bug 630091 - (cov#15512) Fix usage of uninitialized bervalsNathan Kinder2010-09-101-2/+2
| | | | | | When the server is built against MozLDAP, we use some uninitialized bervals when the backend code calls slapi_ldif_parse_line(). We should be initializing the bervals to be empty.
* Bug 690090 - (cov#11974) Remove additional unused ACL functionsNathan Kinder2010-09-091-131/+0
| | | | | | There are a few more unused ACL functions to remove. One of these unused functions is causing coverity to report an error about memory corruption.
* Bug 630094 - (cov#15581) Add missing breaks in agt_mopen_stats()Nathan Kinder2010-09-091-1/+4
| | | | | | | | | | | The switch statements in agt_mopen_stats() are missing breaks to prevent falling through to the next case when the stats file is opened in read-only mode. This looks like it causes the stats file to get opened a second time in read/write mode when ldap-agent attempts to open it in read-only mode. This may leak file descriptors in ldap-agent. We need to add the proper break statements.
* Bug 630094 - (cov#15520) Fix unreachable code issue if perfctrs codeNathan Kinder2010-09-091-3/+4
| | | | | | | | | | | | | The final frees of priv->memory and priv will never be reached since the function returns prior to these calls. It looks as if an "error:" label was removed at some point, as the WIN32 code in this function has goto statements using that label, but the label is not defined. The fix is to add the "error:" label in ifdef blocks for WIN32 that calls the free of priv. The free of priv->memory is not necessary since WIN32 doesn't use it and non-WIN32 builds don't use the error label at all.
* Bug 630094 - (cov#15459) Remove NULL check for srdn in ldif2ldbm codeNathan Kinder2010-09-091-1/+1
| | | | | | | | | | | In the call to slapi_log_error(), we are guaranteed that srdn is NULL if we are checking it for NULL due to the way the conditions are nested. The only time we check if srdn is NULL is if be is non-NULL, and the if condition guarantees that either be or srdn are NULL. We can just use the string "srdn" in our log message if be is non-NULL.
* Bug 630094 - (cov#15458) Fix deadcode issue in moddn codeNathan Kinder2010-09-091-1/+1
| | | | | | | | | | | In the moddn code that renames child entries, the for loop used to rename the children can never be executed. Part of the condition is that retval is 0, but retval will always be -1 the first time we hit this loop. This only happens with subtree rename off, but it should still be fixed. The fix is to set retval to 0 at the prior to checking the condition the first time.
* Bug 630094 - (cov#15457) Remove deadcode in import codeNathan Kinder2010-09-091-4/+0
| | | | | | | | The skipit variable is set to zero shortly before we check if it is 0 in an if condition. This if block can be removed since it will never be hit. The entry that was being freed in the if block is already removed earlier in the function if skipit was non-0 prior to resetting skipit to 0.
* Bug 630094 - (cov#15456) Remove NULL check for srdn in import codeNathan Kinder2010-09-091-1/+1
| | | | | | | | | | | In the call to slapi_log_error(), we are guaranteed that srdn is NULL if we are checking it for NULL due to the way the conditions are nested. The only time we check if srdn is NULL is if inst is non-NULL, and the if condition guarantees that either inst or srdn are NULL. We can just use the string "srdn" in our log message if inst is non-NULL.
* Bug 630094 - (cov#15455) Remove deadcode in attr_index_config()Nathan Kinder2010-09-091-128/+128
| | | | | | | | | If the index types (argv[1]) are not specified, attr_index_config() bails. We can remove some dead code where we check if "argc == 1" later in the function since that case can never happen. Additionally, we need to check if argc is 0, or if argv is NULL before attempting to parse the list of attributes to be indexed.
* Bug 630094 - (cov#15454) Fix deadcode issue in mapping tree codeNathan Kinder2010-09-091-1/+2
| | | | | | | | | | There is no chance for next_node to be anything other than NULL in the final return statement due to the return in the "if (next_node)" block immediately before the final return. We can remove the return inside of the "if (next_node)" block since the final return statement already deals with returning the proper value if next_node is non-NULL.
* Bug 630094 - (cov#15453) Eliminate NULL check for local_newentryNathan Kinder2010-09-091-1/+1
| | | | | | | | There is no chance for local_newentry to be anything other than NULL when we check it in the call to slapi_log_error() since the check only happens after we're verified that newparent and local_origsdn are not NULL. Since we are guaranteed that local_newentry is NULL, we can just eliminate this check and use the string "local entry" in the message that we print.
* Bug 630094 - (cov#15452) Remove NULL checking for op_stringNathan Kinder2010-09-091-26/+27
| | | | | | | | | | | There is no chance for op_string to be NULL if "rc == LDAP_SUCCESS" since op_string is set for all operation types in the switch statement, which is the only place that rc can be set to something other that the value of -1 that it is initialized to. We can just skip the NULL checking for op_string in the calls to slapi_log_error(). I also fixed the indentation to help me read the code easier.
* Bug 630094 - (cov#15451) Get rid of unreachable free statementsNathan Kinder2010-09-091-9/+0
| | | | | | | | | We need to remove the last "if (dnParts)" condition since it will never be true. The last frees of newDN, sval, and newvalue are also unnecessary since they are only set in the non subtree rename case, where they are already freed as well.
* Bug 630094 - (cov#11818) Fix unreachable return in snmp subagentNathan Kinder2010-09-091-17/+33
| | | | | | | | | | | | The return statement at the end of agt_mopen_stats() is unreachable according to coverity. This return was removed before to fix the coverity defect, but it was added back to fix a compiler warning. We can satisfy both the compiler and coverity by adding a rc variable to hold the return code. We can then return rc at the end of the function. This also allows us to clean up all of the return calls in this function by having all of them set rc and jump to a label at the function end.
* Bug 630090 - (cov#15445) Fix illegal free in archive codeNathan Kinder2010-09-091-1/+2
| | | | | | | | | | | The directory variable points to a dynamically allocated string returned by rel2abspath(). We are changing directory to point to a string constant if we are unable to parse the directory. This not only leaks memory, but it can cause us to attempt to free the string constant. We should free the string before we overwrite it, and we should dynamically allocate a new string instead of using a string constant.
* Bug 630090 - (cov#11974) Remove unused ACL functionsNathan Kinder2010-09-094-657/+3
| | | | | | | | | | | | | Coverity flagged a memory corruption issue in an old unused ACL function. It is best to just remove these unused functions. The functions removed are: ACL_ParseFile ACL_WriteFile ACL_WriteString ACL_Decompose acl_to_str_* acl_decompose_*
* Bug 630096 - (cov#15447) - Check return value of idl_append_extend()Nathan Kinder2010-09-081-2/+13
| | | | | | | | | | | We should check the return type of idl_append_extend(), though it does not seem possible that the return type will be anything other than 0. The only time idl_append_extend() returns anything other than 0 is when it is unable to allocate memory. Since the underlying allocation function is slapi_ch_calloc(), the server will just exit if it runs out of memory, which means we will never return up through idl_append_extend(). The right thing to do from a code standpoint is to still check for the return value though.
* Bug 630096 - (cov#15448) Check return value of cache_replace()Nathan Kinder2010-09-081-1/+6
| | | | | | | | | | | We need to check the return value of cache_replace() in id2entry_add_ext(). The only possible error that can be returned is when the entry we are trying to replace is not found in the cache. This should not occur since we are told that the entry already exists by CACHE_ADD() just prior to this call. If we run into this situation, we will just log an error without adding the entry to the cache. This shouldn't be a big deal since the entry will get added to the cache next time it is accessed.
* Bug 630096 - (cov#15449,15450) Check return value of stat()Nathan Kinder2010-09-082-4/+8
| | | | | | We were not checking the return value of stat() before attempting to access the structure that stat fille in in the protect_db code. This patch checks the return value first.
* Bug 630096 - (cov#15446) check return value of ber_scanf()Nathan Kinder2010-09-081-1/+4
| | | | | | | We were not checking the return value of ber_scanf in the DNA plug-in when parsing the range transfer response. This checks the return value and sets the return code to LDAP_PROTOCOL_ERROR if we were unable to parse the range transfer response.
* Bug 630096 - (cov#11778) check return value of ldap_parse_resultNathan Kinder2010-09-081-2/+15
| | | | | | | | | We were not checking the return value of ldap_parse_result in the windows_check_user_password() function. The old code was a bit unclear about setting rc when we encountered errors from ldap_result(). It also was calling ldap_parse_result() even if ldap_result() encountered an error. I fixed this code to be a bit more straightforward.
* Bug 630093 - (cov#15518) Need to intialize fd in ldbm2ldif codeNathan Kinder2010-09-081-4/+3
| | | | | | | | | | | Currently, the ldbm_back_ldbm2ldif() function could bail due to an error before fd is set. We then attempt to close the file that fd refers to. We should initialize fd to STDOUT_FILENUM, as we skip calling close() if fd is set to STDOUT_FILENUM. Additionally, I noticed that we could call close() when fd is negative or if it is STDERR or STDIN. I fixed this so close() is not called in those cases.
* Bug 630093 - (cov#15511) Don't use unintialized search_results in refint pluginNathan Kinder2010-09-081-64/+63
| | | | | | | | | | | The refint plug-in code currently looks as if it could use the search_result variable when it is uninitialized. I don't believe that this is possible since it would require the filter variable to be NULL, which should not occur since slapi_ch_smprintf() would make the process exit if it failed to allocate memory. Even so, the correct thing to do from a code cleanliness standpoint is to move all code that assumes we performed a search into the "if (filter)" block.
* Have to explicitly set protocol version to 3Rich Megginson2010-09-031-0/+5
| | | | | openldap requires that the protocol version be explicitly set to 3 mozldap defaults to 3, but it doesn't hurt to set it again
* Bug 630098 - fix coverity Defect Type: Code maintainability issuesNathan Kinder2010-09-031-2/+0
| | | | | (cov#15521) The oldndn variable was unused in the dncache_replace() function. This patch removes the unused variable.
* Bug 630098 - fix coverity Defect Type: Code maintainability issuesNathan Kinder2010-09-031-2/+0
| | | | | (cov#15521) The newndn variable was unused in the dncache_replace() function. This patch removes the unused variable.
* use slapi_mods_init_passin/get_ldapmods_passout if modifying the smodsRich Megginson2010-09-031-2/+2
| | | | | | | When using slapi_mods_init_byref/get_ldapmods_byref, the slapi_mods code expects the Slapi_Mods to be read-only. Since the usn code adds a mod to the list, it needs to use the slapi_mods_init_passin/get_ldapmods_passout APIs. This avoids an assertion when using --enable-debug.
* Bug 629710 - escape_string does not check '\<HEX><HEX>'Noriko Hosoi2010-09-021-16/+30
| | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=629710 Resolves: 629710 Description: do_escape_string (core of escape_string) converts '\\ (backslash)' to '\5C' even if the following 2 characters are hex digits. That is, the character is already escaped. This patch checks the case and if it is, it does not escape it further.
* Bug 627738 - The cn=monitor statistics entries for the dnentry cacheNoriko Hosoi2010-09-021-3/+4
| | | | | | | | | | | | | do not change or change very rarely https://bugzilla.redhat.com/show_bug.cgi?id=627738 Description: Change made in this commit: cc36301a7cae6737d9f8a0e53bed653a52130a1d for the following bug introduced a missing-cache-return bug: id2entry_add_ext replaces an dn instance in the dn cache even if the DN value is identical. Replace it only when they don't match. Thanks to andrey.ivanov@polytechnique.fr for finding it out: https://bugzilla.redhat.com/show_bug.cgi?id=627738#c5
* fix compiler warnings - unused vars/funcs, invalid castsRich Megginson2010-09-0130-382/+36
| | | | | | | | | This commit fixes many compiler warnings, mostly for things like unused variables, functions, goto labels. One place was using csngen_free instead of csn_free. A couple of places were using casts incorrectly, and several places needed some casts added. Tested on: RHEL5 x86_64, Fedora 14 x86_64 Reviewed by: nkinder (Thanks!)
* bug 614511 - fix coverity null reference - revert macro aci $dn logicRich Megginson2010-09-011-4/+6
| | | | | | instead of changing the logic to catch matched_val == NULL, make the code work like it does in earlier releases, but add an explicit check for matched_val == NULL to avoid using it.
* pass the string copy to slapi_dn_normalize_originalRich Megginson2010-09-011-2/+2
| | | | | | slapi_dn_normalize_original can modify the argument string, so we cannot pass in a const char *rawdn to that function - instead, pass in a copy created by slapi_ch_strdup
* use slapi_pblock_set to set the ldap result code for the be postop pluginsRich Megginson2010-09-012-2/+2
| | | | | use slapi_pblock_set to set the ldap result code for the be postop plugins instead of slapi_pblock_get
* Bug 612264 - ACI issue with (targetattr='userPassword')Nathan Kinder2010-09-011-5/+10
| | | | | | | | | | | | | | If an ACI has a targetattr of userPassword and uses the USERDN keyword, the ACI may not be evaluated correctly for password change operations. This is caused by the fact that we use a dummy target entry to check if the pasword change is allowed early in the operation. This dummy entry will not have any attributes that the ACI may use. The fix is to actually fetch the target entry with all of it's attributes. We still create a dummy entry if the target doesn't exist to prevent returning a no such entry error when we should be returning an access denied or insufficient access error.
* DN normalizer should check the invalid typeNoriko Hosoi2010-08-311-0/+4
| | | | | | | File: ldap/servers/slapd/dn.c Description: slapi_dn_normalize_ext failed to check a typical invald DN (e.g., "bogus,dc=example,dc=com"), in which RDN does not have the type=value format. The problem is fixed.
* implement slapi_ldap_explode_dn and slapi_ldap_explode_rdnRich Megginson2010-08-3116-42/+306
| | | | | | | | | | | | The DS has some problems with the openldap versions of these functions: 1) They are deprecated - should use the str2[r]dn and [r]dn2str and the bv versions of those functions instead 2) They escape utf-8 and other values in the strings - the mozldap functions do not do this 3) They handle double quoted strings, but they remove the quotes - our code expects the quotes to be left in place Until we fix our DN handling, and get rid of the double quoted DNs, we just use the mozldap versions of these functions.
* do not un-null-terminate normalized DN until new url is constructedRich Megginson2010-08-311-27/+21
| | | | | | rawdn may be normalized in place - if we add back the '?' to the URL before we construct the new URL with the normalized DN, we will create a bogus URL string - so delay that until we construct the new URL
* use slapi_ldap_url_parse in the acl codeRich Megginson2010-08-311-8/+33
| | | | | I missed a couple of places in the acl code that should use slapi_ldap_url_parse - I also added some more debugging
* check src < *out only; only check for \nspace if src < *out - 2Rich Megginson2010-08-311-2/+2
| | | | | | | *out will never be NULL here, so we only need to check that src < *out as the loop condition when looking for a continuation line, make sure there are two characters in *out to check
* move the out pointer back if continuation lines were removedRich Megginson2010-08-311-0/+1
| | | | | | when putting ldif data with the no wrap option, if we removed some continuation lines, we have to move the output data pointer back since the continuation line markers are removed in place