Date: Wed, 16 Aug 2006 19:56:58 GMT From: Michael Bushkov <bushman@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 104285 for review Message-ID: <200608161956.k7GJuw9M017449@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=104285 Change 104285 by bushman@bushman_nss_ldap_cached on 2006/08/16 19:56:39 Several small fixes and optimizations (basically - memory issues). Affected files ... .. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/net/nscache.c#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_dns/dns_shells.c#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_dns/nss_dns.c#9 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/Makefile#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agent.c#5 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agent.h#5 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/Makefile.inc#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/group.c#5 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/group.h#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/hosts.c#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/hosts.h#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/net.c#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/net.h#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/passwd.c#5 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/passwd.h#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/proto.c#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/proto.h#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/rpc.c#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/rpc.h#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/services.c#5 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/services.h#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cached.8#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cached.c#5 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cached.conf.5#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cachedcli.c#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cachedcli.h#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cachelib.c#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cachelib.h#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cacheplcs.c#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cacheplcs.h#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/config.c#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/config.h#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/debug.c#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/debug.h#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/hashtable.h#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/log.c#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/log.h#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/mp_rs_query.c#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/mp_rs_query.h#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/mp_ws_query.c#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/mp_ws_query.h#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/parser.c#3 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/parser.h#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/protocol.c#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/protocol.h#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/query.c#4 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/query.h#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/singletons.c#2 edit .. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/singletons.h#2 edit Differences ... ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/net/nscache.c#3 (text) ==== @@ -89,13 +89,12 @@ break; cache_data->key_size <<= 1; - cache_data->key = reallocf(cache_data->key, - cache_data->key_size); + free(cache_data->key); + cache_data->key = malloc(cache_data->key_size); if (cache_data->key == NULL) { res = NS_UNAVAIL; break; } - memset(cache_data->key, 0, cache_data->key_size); va_copy(ap_new, ap); } } while (res == NS_RETURN); @@ -112,7 +111,6 @@ buffer = (char *)malloc(NSS_CACHE_BUFFER_INITIAL_SIZE); if (buffer == NULL) return (NS_UNAVAIL); - memset(buffer, 0, NSS_CACHE_BUFFER_INITIAL_SIZE); do { connection = __open_cached_connection(¶ms); @@ -125,10 +123,10 @@ &buffer_size); __close_cached_connection(connection); if (res == -2 && buffer_size < NSS_CACHE_BUFFER_SIZE_LIMIT) { - buffer = (char *)reallocf(buffer, buffer_size); + free(buffer); + buffer = (char *)malloc(buffer, buffer_size); if (buffer == NULL) return (NS_UNAVAIL); - memset(buffer, 0, buffer_size); } } while (res == -2); @@ -202,7 +200,6 @@ free(cache_data->key); return (NS_UNAVAIL); } - memset(buffer, 0, NSS_CACHE_BUFFER_INITIAL_SIZE); do { size_t size; @@ -218,12 +215,12 @@ break; buffer_size <<= 1; - buffer = (char *)reallocf(buffer, buffer_size); + free(buffer); + buffer = (char *)malloc(buffer_size); if (buffer == NULL) { res = NS_UNAVAIL; break; } - memset(buffer, 0, buffer_size); } } while (res == NS_RETURN); @@ -318,17 +315,16 @@ cache_info->set_mp_rs_func(rs); return (NS_UNAVAIL); } - memset(buffer, 0, NSS_CACHE_BUFFER_INITIAL_SIZE); do { res = __cached_mp_read(rs, buffer, &buffer_size); if (res == -2 && buffer_size < NSS_CACHE_BUFFER_SIZE_LIMIT) { - buffer = (char *)reallocf(buffer, buffer_size); + free(buffer); + buffer = (char *)malloc(buffer); if (buffer == NULL) { res = -1; break; } - memset(buffer, 0, buffer_size); } } while (res == -2); @@ -376,8 +372,7 @@ buffer = (char *)malloc(NSS_CACHE_BUFFER_INITIAL_SIZE); if (buffer == NULL) return (NS_UNAVAIL); - memset(buffer, 0, NSS_CACHE_BUFFER_INITIAL_SIZE); - + ws = cache_info->get_mp_ws_func(); if (ws == INVALID_CACHED_MP_WRITE_SESSION) { memset(¶ms, 0, sizeof(struct cached_connection_params)); @@ -405,12 +400,12 @@ break; buffer_size <<= 1; - buffer = (char *)reallocf(buffer, buffer_size); + free(buffer); + buffer = (char *)malloc(buffer_size); if (buffer == NULL) { res = NS_UNAVAIL; break; } - memset(buffer, 0, buffer_size); } } while (res == NS_RETURN); ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_dns/dns_shells.c#3 (text+ko) ==== @@ -65,10 +65,12 @@ { free(st); } +#endif int __dns_getusershell_r(void *rv, void *cb_data, va_list ap) { +#ifdef HESIOD struct dns_usershell_state *st; char *buffer; size_t buflen; @@ -127,12 +129,16 @@ } hesiod_end(context); - return (r); + return (r); +#else + return (NS_UNAVAIL); +#endif } int __dns_setusershell(void *rv, void *cb_data, va_list ap) { +#ifdef HESIOD struct dns_usershell_state *st; int r; @@ -141,8 +147,6 @@ return (NS_UNAVAIL); st->counter = 0; - +#endif return (NS_UNAVAIL); } - -#endif ==== //depot/projects/soc2006/nss_ldap_cached/src/lib/nss_dns/nss_dns.c#9 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/Makefile#3 (text) ==== @@ -8,7 +8,7 @@ SRCS= agent.c cached.c cachedcli.c cachelib.c cacheplcs.c debug.c log.c \ config.c query.c mp_ws_query.c mp_rs_query.c singletons.c protocol.c \ parser.c -CFLAGS+= -g -DCONFIG_PATH="\"${PREFIX}/etc/cached.conf\"" +CFLAGS+= -DCONFIG_PATH="\"${PREFIX}/etc/cached.conf\"" DPADD+=${LIBM} ${LIBPTHREAD} ${LIBUTIL} LDADD+=${LIBM} ${LIBPTHREAD} ${LIBUTIL} LDFLAGS+= -Xlinker --export-dynamic ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agent.c#5 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agent.h#5 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/Makefile.inc#4 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/group.c#5 (text) ==== @@ -122,7 +122,7 @@ } memcpy(&new_grp, grp, sizeof(struct group)); - memset(buffer, 0, desired_size); + //memset(buffer, 0, desired_size); *buffer_size = desired_size; p = buffer + sizeof(struct group) + sizeof(char *); @@ -192,7 +192,8 @@ TRACE_OUT(group_lookup_func); return (NS_UNAVAIL); } - memset(name, 0, size); + //memset(name, 0, size); + name[size - 1] = '\0'; memcpy(name, key + sizeof(enum nss_lookup_type), size - 1); break; case nss_lt_id: ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/group.h#4 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/hosts.c#4 (text+ko) ==== @@ -133,7 +133,7 @@ } memcpy(&new_ht, ht, sizeof(struct hostent)); - memset(buffer, 0, desired_size); + //memset(buffer, 0, desired_size); *buffer_size = desired_size; p = buffer + sizeof(struct hostent) + sizeof(char *); @@ -205,7 +205,7 @@ return (NS_RETURN); } - memset(buffer, 0, desired_size); + //memset(buffer, 0, desired_size); p = buffer; memcpy(p, &ai_size, sizeof(size_t)); @@ -306,7 +306,8 @@ TRACE_OUT(hosts_lookup_func); return (NS_UNAVAIL); } - memset(str, 0, size); + //memset(str, 0, size); + str[size - 1] = '\0'; memcpy(str, key, key_size); old_options = statp->options; @@ -343,7 +344,8 @@ TRACE_OUT(hosts_lookup_func); return (NS_UNAVAIL); } - memset(str, 0, size); + //memset(str, 0, size); + str[size - 1] = '\0'; memcpy(str, key, key_size); break; case nss_lt_id: ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/hosts.h#3 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/net.c#4 (text+ko) ==== @@ -126,7 +126,7 @@ memcpy(&new_ne, ne, sizeof(struct netent)); *buffer_size = desired_size; - memset(buffer, 0, desired_size); + //memset(buffer, 0, desired_size); p = buffer + sizeof(struct netent) + sizeof(char *); memcpy(buffer + sizeof(struct netent), &p, sizeof(char *)); p = (char *)_ALIGN(p); @@ -188,7 +188,8 @@ TRACE_OUT(networks_lookup_func); return (NS_UNAVAIL); } - memset(name, 0, size); + //memset(name, 0, size); + name[size - 1] = '\0'; memcpy(name, key + sizeof(enum nss_lookup_type), size - 1); break; case nss_lt_id: ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/net.h#3 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/passwd.c#5 (text) ==== @@ -108,7 +108,7 @@ } memcpy(&new_pwd, pwd, sizeof(struct passwd)); - memset(buffer, 0, desired_size); + //memset(buffer, 0, desired_size); *buffer_size = desired_size; p = buffer + sizeof(struct passwd) + sizeof(char *); @@ -191,7 +191,8 @@ TRACE_OUT(passwd_lookup_func); return (NS_UNAVAIL); } - memset(login, 0, size); + //memset(login, 0, size); + login[size - 1] ='\0'; memcpy(login, key + sizeof(enum nss_lookup_type), size - 1); break; case nss_lt_id: ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/passwd.h#4 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/proto.c#4 (text+ko) ==== @@ -123,7 +123,7 @@ memcpy(&new_proto, proto, sizeof(struct protoent)); *buffer_size = desired_size; - memset(buffer, 0, desired_size); + //memset(buffer, 0, desired_size); p = buffer + sizeof(struct protoent) + sizeof(char *); memcpy(buffer + sizeof(struct protoent), &p, sizeof(char *)); p = (char *)_ALIGN(p); @@ -184,7 +184,8 @@ TRACE_OUT(protocols_lookup_func); return (NS_UNAVAIL); } - memset(name, 0, size); + //memset(name, 0, size); + name[size - 1] = '\0'; memcpy(name, key + sizeof(enum nss_lookup_type), size - 1); break; case nss_lt_id: ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/proto.h#3 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/rpc.c#4 (text+ko) ==== @@ -119,7 +119,8 @@ memcpy(&new_rpc, rpc, sizeof(struct rpcent)); *buffer_size = desired_size; - memset(buffer, 0, desired_size); + //memset(buffer, 0, desired_size); + p = buffer + sizeof(struct rpcent) + sizeof(char *); memcpy(buffer + sizeof(struct rpcent), &p, sizeof(char *)); p = (char *)_ALIGN(p); @@ -180,7 +181,8 @@ TRACE_OUT(rpc_lookup_func); return (NS_UNAVAIL); } - memset(name, 0, size); + //memset(name, 0, size); + name[size - 1] = '\0'; memcpy(name, key + sizeof(enum nss_lookup_type), size - 1); break; case nss_lt_id: ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/rpc.h#3 (text+ko) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/services.c#5 (text) ==== @@ -119,7 +119,7 @@ } memcpy(&new_serv, serv, sizeof(struct servent)); - memset(buffer, 0, desired_size); +// memset(buffer, 0, desired_size); *buffer_size = desired_size; p = buffer + sizeof(struct servent) + sizeof(char *); @@ -189,7 +189,8 @@ result = NS_UNAVAIL; goto fin; } - memset(name, 0, size + 1); +// memset(name, 0, size + 1); + name[size] = '\0'; memcpy(name, key + sizeof(enum nss_lookup_type), size); size2 = strlen(name) + 1; @@ -216,7 +217,8 @@ result = NS_UNAVAIL; goto fin; } - memset(proto, size + 1, 0); + //memset(proto, size + 1, 0); + proto[size] = '\0'; memcpy(proto, key + sizeof(enum nss_lookup_type) + sizeof(int), size); } ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/agents/services.h#4 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cached.8#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cached.c#5 (text) ==== @@ -444,7 +444,7 @@ TRACE_OUT(process_socket_event); return; } - memset(qstate->io_buffer, 0, qstate->kevent_watermark); + //memset(qstate->io_buffer, 0, qstate->kevent_watermark); qstate->io_buffer_p = qstate->io_buffer; qstate->io_buffer_size = qstate->kevent_watermark; @@ -524,6 +524,9 @@ memset(&timeout, 0, sizeof(struct timespec)); memset(&eventlist, 0, sizeof(struct kevent) * eventlist_size); +// int j_max = 6016 * 3; +// int j; +// for (j = 0; j < j_max; ++j) { for (;;) { nevents = kevent(env->queue, NULL, 0, eventlist, eventlist_size, NULL); ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cached.conf.5#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cachedcli.c#3 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cachedcli.h#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cachelib.c#3 (text) ==== @@ -555,8 +555,8 @@ return (-1); } - memset(new_entries, 0, sizeof(struct cache_entry_ *) * - new_capacity); +// memset(new_entries, 0, sizeof(struct cache_entry_ *) * +// new_capacity); memcpy(new_entries, the_cache->entries, sizeof(struct cache_entry_ *) * the_cache->entries_size); @@ -589,10 +589,10 @@ TRACE_OUT(register_cache_entry); return (-1); } - memset(new_common_entry->common_params.entry_name, 0, - entry_name_size + 1); - strncpy(new_common_entry->common_params.entry_name, - params->entry_name, entry_name_size); +// memset(new_common_entry->common_params.entry_name, 0, +// entry_name_size + 1); + strlcpy(new_common_entry->common_params.entry_name, + params->entry_name, entry_name_size + 1); new_common_entry->name = new_common_entry->common_params.entry_name; @@ -687,10 +687,10 @@ TRACE_OUT(register_cache_entry); return (-1); } - memset(new_mp_entry->mp_params.entry_name, 0, +// memset(new_mp_entry->mp_params.entry_name, 0, +// entry_name_size + 1); + strlcpy(new_mp_entry->mp_params.entry_name, params->entry_name, entry_name_size + 1); - strncpy(new_mp_entry->mp_params.entry_name, params->entry_name, - entry_name_size); new_mp_entry->name = new_mp_entry->mp_params.entry_name; TAILQ_INIT(&new_mp_entry->ws_head); ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cachelib.h#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cacheplcs.c#3 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/cacheplcs.h#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/config.c#3 (text) ==== @@ -171,7 +171,8 @@ TRACE_OUT(create_configuration_entry); return (NULL); } - memset(retval->name, 0, size + 1); + //memset(retval->name, 0, size + 1); + retval->name[size] = '\0'; memcpy(retval->name, name, size); memcpy(&retval->common_query_timeout, common_timeout, @@ -286,8 +287,8 @@ TRACE_OUT(add_configuration_entry); return (-1); } - memset(new_entries, 0, sizeof(struct configuration_entry *) * - config->entries_capacity); +// memset(new_entries, 0, sizeof(struct configuration_entry *) * +// config->entries_capacity); memcpy(new_entries, config->entries, sizeof(struct configuration_entry *) * config->entries_size); @@ -574,7 +575,8 @@ TRACE_OUT(fill_configuration_defaults); return (-1); } - memset(config->socket_path, 0, len + 1); + //memset(config->socket_path, 0, len + 1); + config->socket_path[len] = '\0'; memcpy(config->socket_path, DEFAULT_SOCKET_PATH, len); len = strlen(DEFAULT_PIDFILE_PATH); @@ -583,7 +585,8 @@ TRACE_OUT(fill_configuration_defaults); return (-1); } - memset(config->pidfile_path, 0, len + 1); + //memset(config->pidfile_path, 0, len + 1); + config->pidfile_path[len] = '\0'; memcpy(config->pidfile_path, DEFAULT_PIDFILE_PATH, len); config->socket_mode = S_IFSOCK | S_IRUSR | S_IWUSR | ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/config.h#3 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/debug.c#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/debug.h#4 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/hashtable.h#3 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/log.c#3 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/log.h#3 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/mp_rs_query.c#4 (text) ==== @@ -121,8 +121,9 @@ TRACE_OUT(on_mp_read_session_request_read1); return (-1); } - memset(c_mp_rs_request->entry, 0, - c_mp_rs_request->entry_length + 1); + //memset(c_mp_rs_request->entry, 0, + // c_mp_rs_request->entry_length + 1); + c_mp_rs_request->entry[c_mp_rs_request->entry_length] = '\0'; qstate->kevent_watermark = c_mp_rs_request->entry_length; qstate->process_func = on_mp_read_session_request_read2; ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/mp_rs_query.h#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/mp_ws_query.c#3 (text) ==== @@ -127,8 +127,9 @@ TRACE_OUT(on_mp_write_session_request_read1); return (-1); } - memset(c_mp_ws_request->entry, 0, - c_mp_ws_request->entry_length + 1); +// memset(c_mp_ws_request->entry, 0, +// c_mp_ws_request->entry_length + 1); + c_mp_ws_request->entry[c_mp_ws_request->entry_length] = '\0'; qstate->kevent_watermark = c_mp_ws_request->entry_length; qstate->process_func = on_mp_write_session_request_read2; @@ -392,7 +393,7 @@ return (-1); } - memset(write_request->data, 0, write_request->data_size); + //memset(write_request->data, 0, write_request->data_size); qstate->kevent_watermark = write_request->data_size; qstate->process_func = on_mp_write_session_write_request_read2; ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/mp_ws_query.h#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/parser.c#3 (text) ==== @@ -374,7 +374,8 @@ res = 0; line_num = 0; - memset(buffer, 0, sizeof(buffer)); + //memset(buffer, 0, sizeof(buffer)); + buffer[0] = '\0'; while ((res == 0) && (fgets(buffer, sizeof(buffer) - 1, fin) != NULL)) { field_count = strbreak(buffer, fields, sizeof(fields)); ++line_num; ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/parser.h#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/protocol.c#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/protocol.h#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/query.c#4 (text) ==== @@ -338,8 +338,9 @@ TRACE_OUT(on_write_request_read1); return (-1); } - memset(write_request->entry, 0, - write_request->entry_length + 1); +// memset(write_request->entry, 0, +// write_request->entry_length + 1); + write_request->entry[write_request->entry_length] = '\0'; write_request->cache_key = (char *)malloc( write_request->cache_key_size + @@ -351,8 +352,8 @@ } memcpy(write_request->cache_key, qstate->eid_str, qstate->eid_str_length); - memset(write_request->cache_key + qstate->eid_str_length, 0, - write_request->cache_key_size); + //memset(write_request->cache_key + qstate->eid_str_length, 0, + // write_request->cache_key_size); if (write_request->data_size != 0) { write_request->data = (char *)malloc( @@ -363,8 +364,8 @@ TRACE_OUT(on_write_request_read1); return (-1); } - memset(write_request->data, 0, - write_request->data_size); +// memset(write_request->data, 0, +// write_request->data_size); } qstate->kevent_watermark = write_request->entry_length + @@ -629,7 +630,8 @@ TRACE_OUT(on_read_request_read1); return (-1); } - memset(read_request->entry, 0, read_request->entry_length + 1); + //memset(read_request->entry, 0, read_request->entry_length + 1); + read_request->entry[read_request->entry_length] = '\0'; read_request->cache_key = (char *)malloc( read_request->cache_key_size + @@ -641,8 +643,8 @@ } memcpy(read_request->cache_key, qstate->eid_str, qstate->eid_str_length); - memset(read_request->cache_key + qstate->eid_str_length, 0, - read_request->cache_key_size); +// memset(read_request->cache_key + qstate->eid_str_length, 0, +// read_request->cache_key_size); qstate->kevent_watermark = read_request->entry_length + read_request->cache_key_size; @@ -952,23 +954,25 @@ } if (transform_request->entry_length != 0) { - if (BUFSIZE_INVALID(transform_request->entry_length)) { - TRACE_OUT(on_transform_request_read1); - return (-1); - } + if (BUFSIZE_INVALID(transform_request->entry_length)) { + TRACE_OUT(on_transform_request_read1); + return (-1); + } - transform_request->entry = (char *)malloc( - transform_request->entry_length + 1); - if (transform_request->entry == NULL) { - TRACE_OUT(on_transform_request_read1); - return (-1); - } - memset(transform_request->entry, 0, - transform_request->entry_length + 1); + transform_request->entry = (char *)malloc( + transform_request->entry_length + 1); + if (transform_request->entry == NULL) { + TRACE_OUT(on_transform_request_read1); + return (-1); + } + //memset(transform_request->entry, 0, + // transform_request->entry_length + 1); + transform_request->entry[transform_request->entry_length] = + '\0'; - qstate->process_func = on_transform_request_read2; + qstate->process_func = on_transform_request_read2; } else - qstate->process_func = on_transform_request_process; + qstate->process_func = on_transform_request_process; qstate->kevent_watermark = transform_request->entry_length; } ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/query.h#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/singletons.c#2 (text) ==== ==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/cached/singletons.h#2 (text) ====
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608161956.k7GJuw9M017449>