sure that sun_entry2amd() is not called when yp_match() returns an
error, this is done by checking that 'res' is 0. Bug fix (same
BZ#); free the output allocated by yp_match() instead of freeing
the return value of sun_entry2amd().
* amd/sun_map.c (sun_entry2amd): Fix a comment.
+2005-10-09 Daniel P. Ottavio <dottavio@ic.sunysb.edu>
+
+ * amd/info_nis.c (nis_search): Bug fix for bugzilla #428; make
+ sure that sun_entry2amd() is not called when yp_match() returns an
+ error, this is done by checking that 'res' is 0. Bug fix (same
+ BZ#); free the output allocated by yp_match() instead of freeing
+ the return value of sun_entry2amd().
+
+ * amd/sun_map.c (sun_entry2amd): Fix a comment.
+
2005-10-09 Erez Zadok <ezk@cs.sunysb.edu>
* README.sun2amd: place holder.
* Lookup key
*/
res = yp_match(gopt.nis_domain, map, key, strlen(key), pval, &outlen);
- if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX)) {
+ if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX) && res == 0) {
char *oldval = *pval;
*pval = sun_entry2amd(key, oldval);
- XFREE(*pval); /* yp_match malloc's *pval above */
+ /* We always need to free the output of the yp_match call. */
+ XFREE(oldval);
+ if (*pval == NULL) {
+ return -1; /* sun2amd parser error */
+ }
}
/*
int ws;
struct sun_entry *s_entry = NULL;
- /* For now the key should no be NULL. */
+ /* The key should not be NULL. */
if (key == NULL) {
plog(XLOG_ERROR,"Sun key value was null");
goto err;