main.c (124861) | main.c (128237) |
---|---|
1/* 2 * Copyright (c) 2001-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Author: Harti Brandt <harti@freebsd.org> 7 * 8 * Redistribution of this software and documentation and use in source and --- 16 unchanged lines hidden (view full) --- 25 * FRAUNHOFER FOKUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 28 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 2001-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Author: Harti Brandt <harti@freebsd.org> 7 * 8 * Redistribution of this software and documentation and use in source and --- 16 unchanged lines hidden (view full) --- 25 * FRAUNHOFER FOKUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 28 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * |
33 * $Begemot: bsnmp/snmpd/main.c,v 1.82 2003/12/09 12:28:52 hbb Exp $ | 33 * $Begemot: bsnmp/snmpd/main.c,v 1.85 2004/04/14 15:39:14 novo Exp $ |
34 * 35 * SNMPd main stuff. 36 */ 37#include <sys/param.h> 38#include <sys/un.h> 39#include <sys/ucred.h> 40#include <stdio.h> 41#include <stdlib.h> --- 793 unchanged lines hidden (view full) --- 835 msg.msg_control = &cmsg; 836 msg.msg_controllen = sizeof(cmsg); 837 838 cmsg.hdr.cmsg_len = sizeof(cmsg); 839 cmsg.hdr.cmsg_level = SOL_SOCKET; 840 cmsg.hdr.cmsg_type = SCM_CREDS; 841 } else { 842 msg.msg_control = NULL; | 34 * 35 * SNMPd main stuff. 36 */ 37#include <sys/param.h> 38#include <sys/un.h> 39#include <sys/ucred.h> 40#include <stdio.h> 41#include <stdlib.h> --- 793 unchanged lines hidden (view full) --- 835 msg.msg_control = &cmsg; 836 msg.msg_controllen = sizeof(cmsg); 837 838 cmsg.hdr.cmsg_len = sizeof(cmsg); 839 cmsg.hdr.cmsg_level = SOL_SOCKET; 840 cmsg.hdr.cmsg_type = SCM_CREDS; 841 } else { 842 msg.msg_control = NULL; |
843 msg.msg_controllen = NULL; | 843 msg.msg_controllen = 0; |
844 } 845 msg.msg_flags = 0; 846 847 iov[0].iov_base = pi->buf; 848 iov[0].iov_len = pi->buflen; 849 850 len = recvmsg(pi->fd, &msg, 0); 851 --- 1158 unchanged lines hidden (view full) --- 2010static int 2011tree_merge(const struct snmp_node *ntree, u_int nsize, struct lmodule *mod) 2012{ 2013 struct snmp_node *xtree; 2014 u_int i; 2015 2016 xtree = realloc(tree, sizeof(*tree) * (tree_size + nsize)); 2017 if (xtree == NULL) { | 844 } 845 msg.msg_flags = 0; 846 847 iov[0].iov_base = pi->buf; 848 iov[0].iov_len = pi->buflen; 849 850 len = recvmsg(pi->fd, &msg, 0); 851 --- 1158 unchanged lines hidden (view full) --- 2010static int 2011tree_merge(const struct snmp_node *ntree, u_int nsize, struct lmodule *mod) 2012{ 2013 struct snmp_node *xtree; 2014 u_int i; 2015 2016 xtree = realloc(tree, sizeof(*tree) * (tree_size + nsize)); 2017 if (xtree == NULL) { |
2018 syslog(LOG_ERR, "lm_load: %m"); | 2018 syslog(LOG_ERR, "tree_merge: %m"); |
2019 return (-1); 2020 } 2021 tree = xtree; 2022 memcpy(&tree[tree_size], ntree, sizeof(*tree) * nsize); 2023 2024 for (i = 0; i < nsize; i++) | 2019 return (-1); 2020 } 2021 tree = xtree; 2022 memcpy(&tree[tree_size], ntree, sizeof(*tree) * nsize); 2023 2024 for (i = 0; i < nsize; i++) |
2025 tree[tree_size + i].data = mod; | 2025 tree[tree_size + i].tree_data = mod; |
2026 2027 tree_size += nsize; 2028 2029 qsort(tree, tree_size, sizeof(tree[0]), compare_node); 2030 2031 return (0); 2032} 2033 2034/* 2035 * Remove all nodes belonging to the loadable module 2036 */ 2037static void 2038tree_unmerge(struct lmodule *mod) 2039{ 2040 u_int s, d; 2041 2042 for(s = d = 0; s < tree_size; s++) | 2026 2027 tree_size += nsize; 2028 2029 qsort(tree, tree_size, sizeof(tree[0]), compare_node); 2030 2031 return (0); 2032} 2033 2034/* 2035 * Remove all nodes belonging to the loadable module 2036 */ 2037static void 2038tree_unmerge(struct lmodule *mod) 2039{ 2040 u_int s, d; 2041 2042 for(s = d = 0; s < tree_size; s++) |
2043 if (tree[s].data != mod) { | 2043 if (tree[s].tree_data != mod) { |
2044 if (s != d) 2045 tree[d] = tree[s]; 2046 d++; 2047 } 2048 tree_size = d; 2049} 2050 2051/* --- 218 unchanged lines hidden --- | 2044 if (s != d) 2045 tree[d] = tree[s]; 2046 d++; 2047 } 2048 tree_size = d; 2049} 2050 2051/* --- 218 unchanged lines hidden --- |