Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

sync with illumos

  • Loading branch information...
commit 23519ef963b13607b1a0b669b07323787caa508b 1 parent d4d1e08
@JohnSonnenschein JohnSonnenschein authored
Showing with 39 additions and 47,827 deletions.
  1. +0 −10 exception_lists/check_rtime
  2. +34 −0 exception_lists/closed-bins
  3. +0 −17 exception_lists/packaging
  4. +0 −1  usr/src/Makefile
  5. +3 −9 usr/src/Makefile.lint
  6. +1 −0  usr/src/Makefile.master
  7. +1 −1  usr/src/cmd/Makefile
  8. +0 −1  usr/src/cmd/Makefile.check
  9. +0 −119 usr/src/cmd/agents/Makefile
  10. +0 −67 usr/src/cmd/agents/Makefile.vars
  11. +0 −48 usr/src/cmd/agents/include/netmgt/netmgt_release.h
  12. +0 −54 usr/src/cmd/agents/include/netmgt/sea_i18n.h
  13. +0 −47 usr/src/cmd/agents/snmp/Makefile
  14. +0 −19 usr/src/cmd/agents/snmp/THIRDPARTYLICENSE
  15. +0 −1  usr/src/cmd/agents/snmp/THIRDPARTYLICENSE.descrip
  16. +0 −45 usr/src/cmd/agents/snmp/agent/Makefile
  17. +0 −70 usr/src/cmd/agents/snmp/agent/Makefile.com
  18. +0 −1,054 usr/src/cmd/agents/snmp/agent/access.c
  19. +0 −186 usr/src/cmd/agents/snmp/agent/access.h
  20. +0 −90 usr/src/cmd/agents/snmp/agent/agent-mapfile-vers
  21. +0 −1,446 usr/src/cmd/agents/snmp/agent/agent.c
  22. +0 −36 usr/src/cmd/agents/snmp/agent/agent.h
  23. +0 −77 usr/src/cmd/agents/snmp/agent/agent_msg.h
  24. +0 −32 usr/src/cmd/agents/snmp/agent/amd64/Makefile
  25. +0 −69 usr/src/cmd/agents/snmp/agent/conf/agent.conf
  26. +0 −36 usr/src/cmd/agents/snmp/agent/config.h
  27. +0 −87 usr/src/cmd/agents/snmp/agent/config.l
  28. +0 −31 usr/src/cmd/agents/snmp/agent/i386/Makefile
  29. +0 −38 usr/src/cmd/agents/snmp/agent/llib-lssagent
  30. +0 −210 usr/src/cmd/agents/snmp/agent/node.c
  31. +0 −155 usr/src/cmd/agents/snmp/agent/node.h
  32. +0 −147 usr/src/cmd/agents/snmp/agent/pagent.c
  33. +0 −86 usr/src/cmd/agents/snmp/agent/pagent.h
  34. +0 −150 usr/src/cmd/agents/snmp/agent/personal.l
  35. +0 −1,914 usr/src/cmd/agents/snmp/agent/personal.y
  36. +0 −1,095 usr/src/cmd/agents/snmp/agent/reg_subtree.c
  37. +0 −59 usr/src/cmd/agents/snmp/agent/reg_subtree.h
  38. +0 −547 usr/src/cmd/agents/snmp/agent/snmpd.c
  39. +0 −43 usr/src/cmd/agents/snmp/agent/snmpd.h
  40. +0 −31 usr/src/cmd/agents/snmp/agent/sparc/Makefile
  41. +0 −32 usr/src/cmd/agents/snmp/agent/sparcv9/Makefile
  42. +0 −352 usr/src/cmd/agents/snmp/agent/subtree.c
  43. +0 −51 usr/src/cmd/agents/snmp/agent/subtree.h
  44. +0 −47 usr/src/cmd/agents/snmp/agent/table.h
  45. +0 −53 usr/src/cmd/agents/snmp/mib/Makefile
  46. +0 −2,124 usr/src/cmd/agents/snmp/mib/draft-ietf-entmib-entmib-02.txt
  47. +0 −443 usr/src/cmd/agents/snmp/mib/em/mib_NSM.em
  48. +0 −414 usr/src/cmd/agents/snmp/mib/gdmo/mib_NSM.gdmo
  49. +0 −72 usr/src/cmd/agents/snmp/mib/gdmo/mib_NSMTYPE.asn1
  50. +0 −73 usr/src/cmd/agents/snmp/mib/mib_ALARM.txt
  51. +0 −654 usr/src/cmd/agents/snmp/mib/mib_DM.txt
  52. +0 −814 usr/src/cmd/agents/snmp/mib/mib_HTTP.txt
  53. +0 −2,635 usr/src/cmd/agents/snmp/mib/mib_II.txt
  54. +0 −656 usr/src/cmd/agents/snmp/mib/mib_MM.txt
  55. +0 −1,375 usr/src/cmd/agents/snmp/mib/mib_MS.txt
  56. +0 −294 usr/src/cmd/agents/snmp/mib/mib_MTRACK.txt
  57. +0 −446 usr/src/cmd/agents/snmp/mib/mib_NSM.txt
  58. +0 −134 usr/src/cmd/agents/snmp/mib/mib_X4GRP.txt
  59. +0 −625 usr/src/cmd/agents/snmp/mib/mib_X4MS.txt
  60. +0 −146 usr/src/cmd/agents/snmp/mib/mib_X5DSA.txt
  61. +0 −198 usr/src/cmd/agents/snmp/mib/mib_core.txt
  62. +0 −162 usr/src/cmd/agents/snmp/mib/mib_demo.txt
  63. +0 −559 usr/src/cmd/agents/snmp/mib/mib_relay.txt
  64. +0 −339 usr/src/cmd/agents/snmp/mib/mib_smi.txt
  65. +0 −171 usr/src/cmd/agents/snmp/mib/mib_trap.txt
  66. +0 −1,119 usr/src/cmd/agents/snmp/mib/rfc1381.txt
  67. +0 −2,890 usr/src/cmd/agents/snmp/mib/rfc1382.txt
  68. +0 −778 usr/src/cmd/agents/snmp/mib/rfc1461.txt
  69. +0 −95 usr/src/cmd/agents/snmp/mib/snm/mib_ALARM.snm
  70. +0 −155 usr/src/cmd/agents/snmp/mib/snm/mib_X4GRP.snm
  71. +0 −657 usr/src/cmd/agents/snmp/mib/snm/mib_X4MS.snm
  72. +0 −163 usr/src/cmd/agents/snmp/mib/snm/mib_X5DSA.snm
  73. +0 −542 usr/src/cmd/agents/snmp/mib/snmpdx.mib
  74. +0 −146 usr/src/cmd/agents/snmp/parser/Makefile
  75. +0 −3,068 usr/src/cmd/agents/snmp/parser/backend.c
  76. +0 −2,357 usr/src/cmd/agents/snmp/parser/parse.c
  77. +0 −164 usr/src/cmd/agents/snmp/parser/parse.h
  78. +0 −170 usr/src/cmd/agents/snmp/snmpdemod/Makefile
  79. +0 −68 usr/src/cmd/agents/snmp/snmpdemod/ReadMe
  80. +0 −109 usr/src/cmd/agents/snmp/snmpdemod/snmpdemo.acl
  81. +0 −93 usr/src/cmd/agents/snmp/snmpdemod/snmpdemo.reg
  82. +0 −49 usr/src/cmd/agents/snmp/snmpdemod/snmpdemo.rsrc
  83. +0 −45 usr/src/cmd/agents/snmp/snmplib/Makefile
  84. +0 −50 usr/src/cmd/agents/snmp/snmplib/Makefile.com
  85. +0 −32 usr/src/cmd/agents/snmp/snmplib/amd64/Makefile
  86. +0 −758 usr/src/cmd/agents/snmp/snmplib/asn1.c
  87. +0 −99 usr/src/cmd/agents/snmp/snmplib/asn1.h
  88. +0 −211 usr/src/cmd/agents/snmp/snmplib/error.c
  89. +0 −60 usr/src/cmd/agents/snmp/snmplib/error.h
  90. +0 −31 usr/src/cmd/agents/snmp/snmplib/i386/Makefile
  91. +0 −805 usr/src/cmd/agents/snmp/snmplib/impl.c
  92. +0 −141 usr/src/cmd/agents/snmp/snmplib/impl.h
  93. +0 −35 usr/src/cmd/agents/snmp/snmplib/llib-lssasnmp
  94. +0 −4,479 usr/src/cmd/agents/snmp/snmplib/madman_api.c
  95. +0 −547 usr/src/cmd/agents/snmp/snmplib/madman_api.h
  96. +0 −236 usr/src/cmd/agents/snmp/snmplib/madman_trap.c
  97. +0 −56 usr/src/cmd/agents/snmp/snmplib/madman_trap.h
  98. +0 −1,685 usr/src/cmd/agents/snmp/snmplib/pdu.c
  99. +0 −124 usr/src/cmd/agents/snmp/snmplib/pdu.h
  100. +0 −444 usr/src/cmd/agents/snmp/snmplib/request.c
  101. +0 −49 usr/src/cmd/agents/snmp/snmplib/request.h
  102. +0 −84 usr/src/cmd/agents/snmp/snmplib/signals.c
  103. +0 −37 usr/src/cmd/agents/snmp/snmplib/signals.h
  104. +0 −109 usr/src/cmd/agents/snmp/snmplib/snmp-mapfile-vers
  105. +0 −67 usr/src/cmd/agents/snmp/snmplib/snmp.h
  106. +0 −1,013 usr/src/cmd/agents/snmp/snmplib/snmp_api.c
  107. +0 −213 usr/src/cmd/agents/snmp/snmplib/snmp_api.h
  108. +0 −114 usr/src/cmd/agents/snmp/snmplib/snmp_msg.h
  109. +0 −31 usr/src/cmd/agents/snmp/snmplib/sparc/Makefile
  110. +0 −32 usr/src/cmd/agents/snmp/snmplib/sparcv9/Makefile
  111. +0 −185 usr/src/cmd/agents/snmp/snmplib/test/Makefile
  112. +0 −144 usr/src/cmd/agents/snmp/snmplib/test/asn1_test.c
  113. +0 −73 usr/src/cmd/agents/snmp/snmplib/test/error_test.c
  114. +0 −935 usr/src/cmd/agents/snmp/snmplib/test/madman_api_test.c
  115. +0 −920 usr/src/cmd/agents/snmp/snmplib/test/madman_api_test_2.c
  116. +0 −125 usr/src/cmd/agents/snmp/snmplib/test/madman_trap_test.c
  117. +0 −57 usr/src/cmd/agents/snmp/snmplib/test/trap_test.c
  118. +0 −125 usr/src/cmd/agents/snmp/snmplib/trace.c
  119. +0 −56 usr/src/cmd/agents/snmp/snmplib/trace.h
Sorry, we could not display the entire diff because too many files (2,642) changed.
View
10 exception_lists/check_rtime
@@ -21,7 +21,6 @@
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2010, Richard Lowe
#
# This file provides exceptions to the usual rules applied to ELF objects by
@@ -118,14 +117,10 @@ UNUSED_RPATH /usr/lib/mps.*\ from\ .*libnss3\.so
UNUSED_RPATH /usr/lib/mps.*\ from\ .*libnssutil3\.so
UNUSED_RPATH /usr/lib/mps.*\ from\ .*libsmime3\.so
UNUSED_RPATH /usr/lib/mps.*\ from\ .*libssl3\.so
-UNUSED_RPATH /usr/sfw/lib.*\ from\ .*libavahi-[^\.]*.so
UNUSED_RPATH /usr/sfw/lib.*\ from\ .*libdbus-1\.so\.3
UNUSED_RPATH /usr/sfw/lib.*\ from\ .*libdbus-glib-1\.so\.2
UNUSED_RPATH /usr/sfw/lib.*\ from\ .*libglib-2\.0\.so\.0
UNUSED_RPATH /usr/X11/lib.*\ from\ .*libglib-2\.0\.so\.0
-UNUSED_RPATH /usr/sfw/lib.*\ from\ .*libgmodule-2\.0\.so\.0
-UNUSED_RPATH /usr/X11/lib.*\ from\ .*libgmodule-2\.0\.so\.0
-UNUSED_RPATH /usr/sfw/lib.*\ from\ .*libgnomevfs-2\.so\.0
UNUSED_RPATH /usr/sfw/lib.*\ from\ .*libgobject-2\.0\.so\.0
UNUSED_RPATH /usr/X11/lib.*\ from\ .*libgobject-2\.0\.so\.0
UNUSED_RPATH /usr/sfw/lib.*\ from\ .*libgthread-2\.0\.so\.0
@@ -142,15 +137,11 @@ UNUSED_RPATH /usr.*\ from\ .*tst\.gcc\.exe # gcc built
# Unreferenced objects of non-OSnet objects we can't change
-UNREF_OBJ /lib.*\ of\ .*libavahi-[^\.]*\.so
UNREF_OBJ /lib.*\ of\ .*libcimapi\.so
UNREF_OBJ /lib.*\ of\ .*libdbus-1\.so\.3
UNREF_OBJ /lib.*\ of\ .*libdbus-glib-1\.so\.2
-UNREF_OBJ /lib.*\ of\ .*libgconf-2\.so\.4
UNREF_OBJ /lib.*\ of\ .*libglib-2.0\.so\.0
-UNREF_OBJ /lib.*\ of\ .*libgmodule-2.0\.so\.0
UNREF_OBJ /lib.*\ of\ .*libgobject-2.0\.so\.0
-UNREF_OBJ /lib.*\ of\ .*libgnomevfs-2\.so\.0
UNREF_OBJ /lib.*\ of\ .*libgthread-2\.0\.so\.0
UNREF_OBJ /lib.*\ of\ .*libjvm\.so
UNREF_OBJ /lib.*\ of\ .*libnetsnmp\.so\.15
@@ -158,7 +149,6 @@ UNREF_OBJ /lib.*\ of\ .*libnetsnmpagent\.so\.15
UNREF_OBJ /lib.*\ of\ .*libnetsnmpmibs\.so\.15
UNREF_OBJ /lib.*\ of\ .*libnetsnmphelpers\.so\.15
UNREF_OBJ /lib.*\ of\ .*libnspr4\.so
-UNREF_OBJ /lib.*\ of\ .*libORBit-2\.so\.0
UNREF_OBJ /lib.*\ of\ .*libpq\.so\.5
UNREF_OBJ /lib.*\ of\ .*libsoftokn3\.so
UNREF_OBJ /lib.*\ of\ .*libspmicommon\.so\.1
View
34 exception_lists/closed-bins
@@ -1,15 +1,37 @@
+./etc/certs
./etc/init.d/llc2
+./etc/rc1.d
./etc/rc1.d/K52llc2
+./etc/rc0.d
./etc/rc0.d/K52llc2
+./etc/rcS.d
./etc/rcS.d/K52llc2
./etc/llc2
./etc/llc2/llc2_start.default
./etc/rc2.d/S40llc2
+./etc/snmp
+./etc/snmp/conf
+./etc/snmp/conf/mibiisa.reg
+./etc/snmp/conf/snmp.conf
+./kernel/drv/iprb
+./kernel/drv/amd64/iprb
+./lib/crypto
./lib/crypto/kcfd
./lib/libc_i18n.a
./lib/amd64/libc_i18n.a
./lib/sparcv9/libc_i18n.a
+./platform/sun4v/kernel/drv/ncp.conf
+./platform/sun4v/kernel/drv/n2cp.conf
+./usr/has
+./usr/has/bin
./usr/has/bin/patch
+./usr/kernel
+./usr/kernel/strmod
+./usr/kernel/strmod/amd64
+./usr/kernel/strmod/sparcv9
+./usr/kernel/drv
+./usr/kenrel/drv/amd64
+./usr/kenrel/drv/sparcv9
./usr/kernel/drv/amd64/llc2
./usr/kernel/drv/sparcv9/llc2
./usr/kernel/drv/llc2.conf
@@ -37,12 +59,17 @@
./usr/lib/localedef/src/iso_8859_1/charmap.src
./usr/lib/localedef/src/iso_8859_1/extension.src
./usr/lib/localedef/src/iso_8859_1/localedef.src
+./usr/lib/snmp
+./usr/lib/snmp/mibiisa
./usr/bin/kbdcomp
./usr/bin/localedef
./usr/bin/od
./usr/bin/printf
+./usr/bin/sed
./usr/bin/tr
./usr/bin/tail
+./usr/platform/i86pc
+./usr/platform/i86pc/lib
./usr/xpg4/bin/alias
./usr/xpg4/bin/bg
./usr/xpg4/bin/cd
@@ -55,6 +82,7 @@
./usr/xpg4/bin/kill
./usr/xpg4/bin/od
./usr/xpg4/bin/read
+./usr/xpg4/bin/sed
./usr/xpg4/bin/sh
./usr/xpg4/bin/tail
./usr/xpg4/bin/test
@@ -64,4 +92,10 @@
./usr/xpg4/bin/umask
./usr/xpg4/bin/unalias
./usr/xpg4/bin/wait
+./usr/xpg6
+./usr/xpg6/bin
./usr/xpg6/bin/tr
+./var
+./var/snmp
+./var/snmp/mib
+./var/snmp/mib/sun.mib
View
17 exception_lists/packaging
@@ -936,20 +936,3 @@ licenses
# Libbe is private
#
usr/include/libbe_priv.h
-#
-# Exception List for packaging during an open-only build - I'm not
-# sure why we even have dprov given that it isn't packaged. It looks
-# like it exists to emulate a real hardware provider probably for test.
-#
-kernel/crypto/amd64/dprov i386
-kernel/crypto/dprov i386
-kernel/crypto/sparcv9/dprov sparc
-kernel/drv/amd64/dprov i386
-kernel/drv/dprov i386
-kernel/drv/dprov.conf
-kernel/drv/sparcv9/dprov sparc
-#
-# Probably we should nuke this one, along with any other vestiges of
-# ksh88.
-#
-usr/has/bin/pfksh
View
1  usr/src/Makefile
@@ -312,7 +312,6 @@ CRYPT_SRC:
@cd uts/common/gssapi/include; pwd; $(MAKE) CRYPT_SRC
@cd uts/common/gssapi/mechs/dummy; pwd; $(MAKE) CRYPT_SRC
@cd uts/common/gssapi/mechs/krb5; pwd; $(MAKE) CRYPT_SRC
- @cd pkg; pwd; $(MAKE) CRYPT_SRC
$(RM) Makefile+
sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
< Makefile > Makefile+
View
12 usr/src/Makefile.lint
@@ -269,6 +269,7 @@ COMMON_SUBDIRS = \
cmd/savecore \
cmd/sbdadm \
cmd/sdpadm \
+ cmd/sed \
cmd/setpgrp \
cmd/smbios \
cmd/sgs \
@@ -340,6 +341,7 @@ COMMON_SUBDIRS = \
lib/brand/solaris10 \
lib/crypt_modules \
lib/extendedFILE \
+ lib/libadm \
lib/libadutils \
lib/libadt_jni \
lib/libaio \
@@ -407,7 +409,7 @@ COMMON_SUBDIRS = \
lib/libpctx \
lib/libpicl \
lib/libpicltree \
- lib/libplot \
+ lib/libpkg \
lib/libpool \
lib/libproc \
lib/libpthread \
@@ -476,12 +478,6 @@ COMMON_SUBDIRS = \
ucbcmd/users \
ucbcmd/whoami
-$(CLOSED_BUILD)COMMON_SUBDIRS += \
- $(CLOSED)/cmd/cmd-inet/usr.lib/in.iked \
- $(CLOSED)/cmd/pax \
- $(CLOSED)/cmd/sed_xpg4 \
- $(CLOSED)/lib/libc_i18n
-
i386_SUBDIRS= \
cmd/acpihpd \
cmd/biosdev \
@@ -512,8 +508,6 @@ sparc_SUBDIRS= \
lib/storage \
stand
-$(CLOSED_BUILD)COMMON_SUBDIRS += $(CLOSED)/cmd/mtst
-
LINTSUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
.PARALLEL: $(LINTSUBDIRS)
View
1  usr/src/Makefile.master
@@ -504,6 +504,7 @@ DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging.
DTS_ERRNO=-D_TS_ERRNO
CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
+CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
CPPFLAGS= $(CPPFLAGS.master)
AS_CPPFLAGS= $(CPPFLAGS.master)
JAVAFLAGS= -deprecation
View
2  usr/src/cmd/Makefile
@@ -45,7 +45,6 @@ FIRST_SUBDIRS= \
platexec
COMMON_SUBDIRS= \
- agents \
allocate \
availdevs \
lp \
@@ -358,6 +357,7 @@ COMMON_SUBDIRS= \
scsi \
sdiff \
sdpadm \
+ sed \
sendmail \
setfacl \
setmnt \
View
1  usr/src/cmd/Makefile.check
@@ -77,7 +77,6 @@ MANIFEST_TOPDIRS= \
zoneadmd
MANIFEST_SUBDIRS= \
- agents/snmp/snmprelayd \
boot/scripts \
cmd-crypto/scripts \
cmd-inet/usr.lib/ilbd \
View
119 usr/src/cmd/agents/Makefile
@@ -1,119 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-# cmd/agents/Makefile
-
-#########################################################
-#
-# Makefile for the Solstice Enterprise Agent
-#
-# Targets:
-# all - compile everything
-# install - create installation directories and copy files
-# package - create packages in installation directory
-# clean - remove all intermediate files
-# clobber - make clean plus removing deliverable files
-# lint - run lint on the source files
-#
-#########################################################
-
-# OPTIONAL_INCLUDE_FILE:sh = /bin/sh misc.sh ../Makefile.cmd
-# include $(OPTIONAL_INCLUDE_FILE)
-
-include $(SRC)/cmd/Makefile.cmd
-
-# Use $TARG_SYS for OS dependent variables
-#
-# TARG_SYS gets defined as SVR4 or SUNOS
-#
-TARG_SYS:sh = \
- ( \
- UNAME=` uname -r 2>/dev/null` ||.; \
- case $UNAME in \
- '') echo SUNOS;; \
- 4.*) echo SUNOS;; \
- 5.*) echo SVR4;; \
- A.09.*) echo HPUX9;; \
- *) echo SVR4;; \
- esac \
- )
-
-ROOTDIR : sh=echo ${ROOTDIR:-"`pwd`"}
-PKGLOC : sh=echo ${PKGLOC:-'${ROOTDIR}/PACKAGES.`uname -p`'}
-
-$(CLOSED_BUILD)AGENTS= $(CLOSED)/cmd/agents/agents
-
-all := TARGET = all
-clean := TARGET = clean
-install := TARGET = install
-lint := TARGET = lint
-clobber := TARGET = clobber
-
-SUBDIRS = snmp $(AGENTS)
-
-#
-# all
-#
-
-all: $(SUBDIRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-DIRMODE= 0755
-ROOTVAR= $(ROOT)/var
-
-ROOTDIRS= $(ROOTETC)/snmp \
- $(ROOTETC)/snmp/conf \
- $(ROOTLIB)/snmp \
- $(ROOTBIN) \
- $(ROOTVAR)/snmp \
- $(ROOTVAR)/snmp/mib
-
-$(ROOTDIRS):
- $(INS.dir)
-
-#
-# Need a "make install" target for integrating into Solaris 2.6.
-#
-
-install: $(ROOTDIRS) $(SUBDIRS)
-
-#
-# clean
-#
-
-clean: $(SUBDIRS)
-
-clobber: $(SUBDIRS)
-
-# Need a lint target for Solaris2.6 integration.
-
-lint: $(SUBDIRS)
-
-include $(SRC)/cmd/Makefile.targ
View
67 usr/src/cmd/agents/Makefile.vars
@@ -1,67 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 1998 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-
-#ident "%Z%%M% %I% %E% SMI"
-
-BIN = bin$(TARGET_ARCH)
-LDFLAGS += -g $(LDLIBS)
-
-#
-# Compiler selection
-#
-TARG_SYS:sh = \
- ( \
- UNAME=` uname -r 2>/dev/null` ||.; \
- case $UNAME in \
- '') echo SUNOS;; \
- 4.*) echo SUNOS;; \
- 5.*) PNAME=`uname -p 2>/dev/null` ||.; \
- case $PNAME in \
- '') echo SVR4;; \
- i386) echo INTEL;; \
- *) echo SVR4;; \
- esac;; \
- *) echo SVR4;; \
- esac \
- )
-
-CCC += -norunpath -nolib
-
-SVR4_STRIP= /usr/ccs/bin/strip
-INTEL_STRIP= /usr/ccs/bin/strip
-SUNOS_STRIP=/bin/strip
-_STRIP=$(SVR4_STRIP)
-STRIP=$($(TARG_SYS)_STRIP)
-
-SVR4_SNMHOME=/opt/SUNWconn/snm
-INTEL_SNMHOME=
-SUNOS_SNMHOME=/usr/snm
-_SNMHOME=$(SVR4_SNMHOME)
-SNMHOME=$($(TARG_SYS)_SNMHOME)
-
-#
-# Misc Tools
-#
-
-TEST = test
-
View
48 usr/src/cmd/agents/include/netmgt/netmgt_release.h
@@ -1,48 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2000 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#if !defined(lint) && !defined(NOID)
-#ifdef SVR4
-#pragma ident "%Z%%M% %I% %E% SMI"
-#endif
-#endif
-
-#ifndef lint
-#ifndef _release_h
-#define _release_h
-
-static char product_name[]="Product:Site/Domain/SunNet Manager" ;
-#ifdef SVR4
-#ifdef i386
-static char release[]="Release:2.3 FCS - Solaris X86" ;
-#else
-static char release[]="Release:2.3 FCS - Solaris 2" ;
-#endif
-#else
-static char release[]="Release:2.3 FCS - Solaris 1" ;
-#endif
-#endif /* _release_h */
-#endif /* lint */
View
54 usr/src/cmd/agents/include/netmgt/sea_i18n.h
@@ -1,54 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/* Copyright 1996 Sun Microsystems, Inc. All Rights Reserved. */
-
-
-#ifndef sea_1_0_i18n_h
-#define sea_1_0_i18n_h
-
-
-#include <sys/param.h>
-#include <locale.h>
-#include <libintl.h>
-
-#define SEA_LOCALE_PATH "/opt/SUNWconn/snm/lib/locale"
-
-#define DOMAIN_LGET "SUNW_SEA_LABELS"
-#define DOMAIN_MGET "SUNW_SEA_MESSAGES"
-#define DOMAIN_SGET "SUNW_SEA_SCHEMAS"
-#define DOMAIN_LIBGET "SUNW_SEA_LIBRARIES"
-#define DOMAIN_FGET "SUNW_SEA_FORMATS"
-
-
-#define LGET(s) (char *) dgettext(DOMAIN_LGET, s)
-#define MGET(s) (char *) dgettext(DOMAIN_MGET, s)
-#define MGET(s) (char *) dgettext(DOMAIN_MGET, s)
-#define SGET(s) (char *) dgettext(DOMAIN_SGET, s)
-#define LIBGET(s) (char *) dgettext(DOMAIN_LIBGET, s)
-#define FGET(s) (char *) dgettext(DOMAIN_FGET, s)
-
-
-#define I18N_KEY 628323
-
-#endif /* sea_1_0_i18n_h*/
-
View
47 usr/src/cmd/agents/snmp/Makefile
@@ -1,47 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#ident "%Z%%M% %I% %E% SMI"
-
-SUBDIRS= snmplib \
- agent \
- parser \
- snmprelayd \
- trapsend \
- mib
-
-
-all := TARGET= all
-install := TARGET= install
-clean := TARGET= clean
-clobber := TARGET= clobber
-lint := TARGET= lint
-
-all install clean clobber lint: $(SUBDIRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
View
19 usr/src/cmd/agents/snmp/THIRDPARTYLICENSE
@@ -1,19 +0,0 @@
- Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of CMU not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
View
1  usr/src/cmd/agents/snmp/THIRDPARTYLICENSE.descrip
@@ -1 +0,0 @@
-PORTIONS OF SNMP FUNCTIONALITY
View
45 usr/src/cmd/agents/snmp/agent/Makefile
@@ -1,45 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 1998 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include $(SRC)/cmd/Makefile.cmd
-
-SUBDIRS= $(MACH)
-$(BUILD64)SUBDIRS += $(MACH64)
-
-all := TARGET= all
-install := TARGET= install
-clean := TARGET= clean
-clobber := TARGET= clobber
-lint := TARGET= lint
-install_h := TARGET= install_h
-
-all install clean clobber lint: $(SUBDIRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
View
70 usr/src/cmd/agents/snmp/agent/Makefile.com
@@ -1,70 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-LIBRARY = libssagent.a
-VERS = .1
-SRCOBJS = node.o access.o agent.o snmpd.o pagent.o subtree.o reg_subtree.o
-OBJECTS = $(SRCOBJS) personal.o
-
-include $(SRC)/lib/Makefile.lib
-
-LIBS = $(DYNLIB) $(LINTLIB)
-SRCS = $(SRCOBJS:%.o=$(SRCDIR)/%.c) personal.c
-
-$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC)
-LDLIBS += -lssasnmp -lc -lsocket -lnsl
-
-CLEANFILES += personal.c personal.lex.c
-
-MAPFILES = ../agent-mapfile-vers
-
-CPPFLAGS = -I. -I.. -I../../snmplib $(CPPFLAGS.master)
-LINTFLAGS64 += -errchk=longptr64
-#
-# This library has references to hooks that are defined by the programs
-# that link with it; need to turn off -zdefs.
-#
-ZDEFS =
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-personal.c: ../personal.y
- $(YACC.y) ../personal.y
- $(MV) y.tab.c personal.c
-
-personal.lex.c: ../personal.l
- $(LEX.l) ../personal.l > personal.lex.c
-
-pics/personal.o: personal.c personal.lex.c
- $(COMPILE.c) -o pics/personal.o personal.c
- $(POST_PROCESS_O)
-
-lint: lintcheck
-
-include $(SRC)/lib/Makefile.targ
View
1,054 usr/src/cmd/agents/snmp/agent/access.c
@@ -1,1054 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "impl.h"
-#include "error.h"
-#include "trace.h"
-#include "asn1.h"
-#include "snmp.h"
-#include "trap.h"
-
-#include "agent_msg.h"
-#include "access.h"
-
-#define WILD_CARD_HOST_NAME "*"
-#define WILD_CARD_ADDRESS 0
-
-#define MAX_BUF_SIZE 256
-
-/***** STATIC VARIABLES *****/
-
-static Manager *first_manager = NULL;
-static Community *first_community = NULL;
-
-static EFilter *first_efilter = NULL;
-
-static NameOidPair *first_name_oid_pair = NULL;
-
-
-void init_manager_set ()
-{
- first_community = NULL; /* TODO: check this out */
- first_manager = NULL;
-}
-
-void set_first_manager (Manager *mgr)
-{
- first_manager = mgr;
-}
-
-Manager * get_curr_manager_set ()
-{
- return first_manager;
-}
-
-/***********************************************************/
-
-/*
- * returns 0 if OK
- * 1 if error
- * -1 if fatal error
- */
-
-Manager* manager_add(char *name, char *error_label)
-{
- IPAddress ip_address;
- Manager *new;
- Manager *m;
-
-
- error_label[0] = '\0';
-
-
- if(name == NULL)
- {
- (void)sprintf(error_label, "BUG: manager_add(): name is NULL");
- return NULL;
- }
-
-
- /* skip the ip adx for wild-card host */
-
- if(strcmp(name,WILD_CARD_HOST_NAME)){
- /* try to find the IP address from the name */
- if(name_to_ip_address(name, &ip_address, error_label))
- {
- return NULL;
- }
- }
-
-
- /* checking for dup is on the wild-card host name */
-
-
- /* check if this manager does not already exist */
- if(strcmp(name,WILD_CARD_HOST_NAME)){
- for(m = first_manager; m; m = m->next_manager)
- {
- if(ip_address.s_addr == m->ip_address.s_addr)
- {
- (void)sprintf(error_label, ERR_MSG_MANAGER_DUP, name);
- return m;
- }
- }
- }else{
- for(m = first_manager; m; m = m->next_manager)
- {
- if(!strcmp(m->name,name))
- {
- return m;
- }
- }
- }
-
-
- /* allocate, initialize and link the new manager */
- new = (Manager *) calloc(1,sizeof(Manager));
- if(new == NULL)
- {
- (void)sprintf(error_label, ERR_MSG_ALLOC);
- return NULL;
- }
- new->next_manager = NULL;
- new->name = NULL;
-
- new->name = strdup(name);
- if(new->name == NULL)
- {
- (void)sprintf(error_label, ERR_MSG_ALLOC);
- free(new);
- return NULL;
- }
-
- /* ip adx for wild-card host should be zero */
-
- if(strcmp(name,WILD_CARD_HOST_NAME)){
- new->ip_address.s_addr = ip_address.s_addr;
- }else{
- new->ip_address.s_addr = WILD_CARD_ADDRESS;
-
- }
-
- new->next_manager = first_manager;
- first_manager = new;
-
-
- return new;
-}
-
-/***********************************************************/
-
-/*
- * returns a pointer to the manager if the request succeeds,
- * otherwise returns NULL
- */
-
-Manager *is_valid_manager(Address *address, Manager **mngr)
-{
- Manager *m;
-
- *mngr = NULL;
-
- if(address == NULL)
- {
- error("BUG: is_valid_manager(): address is NULL");
- return NULL;
- }
-
- if(first_manager == NULL)
- {
- return NULL;
- }
-
- for(m = first_manager; m; m = m->next_manager)
- {
- if(address->sin_addr.s_addr == m->ip_address.s_addr)
- {
- *mngr = m;
- return m;
- }
- }
-
- /* check for wild-card host */
- for(m = first_manager; m; m = m->next_manager)
- {
- if(!strcmp(m->name,WILD_CARD_HOST_NAME)){
- *mngr = m;
- return m;
- }
- }
-
- return m;
-}
-
-/***********************************************************/
-
-void delete_manager_list()
-{
- Manager *next;
-
-
- while(first_manager)
- {
- next = first_manager->next_manager;
-
- if(first_manager->name)
- {
- free(first_manager->name);
- }
-
- free(first_manager);
-
- first_manager = next;
- }
-
- first_manager = NULL;
-}
-
-void manager_list_free(Manager *mngr)
-{
- Manager *next;
-
-
- while(mngr)
- {
- next = mngr->next_manager;
-
- if(mngr->name)
- {
- free(mngr->name);
- }
-
- free(mngr);
-
- mngr = next;
- }
-
- mngr = NULL;
-}
-
-void sub_member_free(SubMember *mem)
-{
- Manager *mngr;
-
- if(mem==NULL) return;
- mem->count--;
- if(mem->count<0){
- mngr = mem->first_manager;
- manager_list_free(mngr);
- if(mem->community_string != NULL) free(mem->community_string);
- free(mem);
- }
-}
-
-void sub_group_list_free(SubGroup *group)
-{
- SubGroup *next;
-
-
- while(group)
- {
- next = group->next_sub_group;
-
- if(group->first_sub_member != NULL)
- {
- sub_member_free(group->first_sub_member);
- }
-
- free(group);
-
- group = next;
- }
-
-}
-
-void trap_slot_list_free(TrapSlot *slot)
-{
- TrapSlot *next;
-
-
- while(slot)
- {
- next = slot->next_trap_slot;
- if(slot->first_sub_group != NULL)
- {
- sub_group_list_free(slot->first_sub_group);
- }
-
- free(slot);
-
- slot = next;
- }
-
-}
-
-
-void delete_efilter_list()
-{
- EFilter *next;
-
-
- while(first_efilter)
- {
- next = first_efilter->next_efilter;
-
- if(first_efilter->name)
- {
- free(first_efilter->name);
- }
-
- free(first_efilter);
-
- first_efilter = next;
- }
-
- first_efilter = NULL;
-}
-
-/***********************************************************/
-
-void trace_managers()
-{
- Manager *m;
- AccessServer *as;
-
- trace("MANAGERS:\n");
- trace("---------\n");
- for(m = first_manager; m; m = m->next_manager)
- {
- trace("%-30s %-20s\n",
- m->name,
- !strcmp(m->name,WILD_CARD_HOST_NAME)?
- "0":inet_ntoa(m->ip_address) );
- for(as=m->first_acc_server;as;as=as->next_acc_server)
- trace_access_server(as);
-
- }
- trace("\n");
-}
-
-
-/***********************************************************/
-
-/*
- * returns 0 if OK
- * 1 if error
- * -1 if fatal error
- */
-
-int community_add(char *name, int type, char *error_label)
-{
- int ret;
- Community *new;
- Community *c;
- Community *last = NULL;
-
-
- error_label[0] = '\0';
-
- if(name == NULL)
- {
- (void)sprintf(error_label, "BUG: community_add(): name is NULL");
- return -1;
- }
-
- if(name[0] == '\0')
- {
- (void)sprintf(error_label, "BUG: community_add(): name is empty");
- return -1;
- }
-
- if( (type != READ_ONLY) && (type != READ_WRITE) )
- {
- (void)sprintf(error_label, "BUG: community_add(): bad type (%d)", type);
- return -1;
- }
-
- for(c = first_community; c; c = c->next_community)
- {
- ret = strcmp(name, c->name);
- if(ret > 0)
- {
- break;
- }
- else
- if(ret == 0)
- {
- (void)sprintf(error_label, ERR_MSG_COMMUNITY_DUP, name);
- return 1;
- }
-
- last = c;
- }
-
- new = (Community *) calloc(1,sizeof(Community));
- if(new == NULL)
- {
- (void)sprintf(error_label, ERR_MSG_ALLOC);
- return -1;
- }
- new->next_community = NULL;
- new->name = NULL;
-
- new->name = strdup(name);
- if(new->name == NULL)
- {
- (void)sprintf(error_label, ERR_MSG_ALLOC);
- free(new);
- return -1;
- }
-
- new->type = type;
-
- if(last)
- {
- last->next_community = new;
- }
- else
- {
- first_community = new;
- }
- new->next_community = c;
-
-
- return 0;
-}
-
-int get_access_type(Manager *mngr,char *name)
-{
- AccessServer *as;
- AccessPolicy *ap;
- Community *comm;
-
- if(name==NULL || mngr==NULL) return NULL;
- for(as=mngr->first_acc_server;as;as=as->next_acc_server)
- {
- if((ap=as->first_acc_policy)!=NULL)
- for(comm=ap->first_community;comm;comm=comm->next_community)
- if(comm->name!=NULL && !strcmp(name,comm->name))
- return ap->access_type;
- }
- return -1;
-}
-
-
-/***********************************************************/
-
-/* returns True or False */
-
-int is_valid_community(char *name, int type, Manager *mngr)
-{
- int access_type;
-
-
- if(name == NULL)
- {
- error("BUG: is_valid_community(): name is NULL");
- return False;
- }
-
- if( (type != GETNEXT_REQ_MSG )
- && (type != GET_REQ_MSG)
- && (type != SET_REQ_MSG) )
- {
- error("BUG: is_valid_community(): bad type(0x%x)", type);
- return False;
- }
-
- if(mngr==NULL) return True; /* accept reqs from any hosts */
-
- if(mngr->first_acc_server!=NULL){
- if( (access_type = get_access_type(mngr,name)) == -1)
- return False;
- }
-
- if(type != SET_REQ_MSG)
- {
- return True;
- }
- else
- {
- if(access_type == READ_WRITE)
- {
- return True;
- }
- else
- {
- return False;
- }
- }
-
-}
-
-
-/***********************************************************/
-
-void delete_community_list()
-{
- Community *next;
-
-
- while(first_community)
- {
- next = first_community->next_community;
-
- if(first_community->name)
- {
- free(first_community->name);
- }
-
- free(first_community);
-
- first_community = next;
- }
-
- first_community = NULL;
-}
-
-
-/***********************************************************/
-
-void trace_access_server(AccessServer *as)
-{
- AccessPolicy *ap;
-
- if(as==NULL) return;
- if( (ap=as->first_acc_policy)!=NULL )
- trace_access_policy(ap);
-}
-
-void trace_access_policy(AccessPolicy *ap)
-{
- Community *c;
-
- if(ap==NULL) return;
- trace("\tCOMMUNITIES(");
- switch(ap->access_type)
- {
- case READ_ONLY:
- trace("%s", "READ_ONLY");
- break;
- case READ_WRITE:
- trace("%s", "READ_WRITE");
- break;
- }
- trace("): ");
- for(c=ap->first_community;c;c=c->next_community)
- trace_communities(c);
- trace("\n");
-}
-
-void trace_communities(Community *c)
-{
-
-
- trace(" %s", c->name);
-}
-
-
-/***********************************************************/
-void community_list_free(Community *comm)
-{
- Community *next;
-
-
- while(comm)
- {
- next = comm->next_community;
-
- if(comm->name)
- {
- free(comm->name);
- }
-
- free(comm);
-
- comm = next;
- }
-
- comm = NULL;
-}
-
-void access_policy_list_delete(AccessPolicy *ap)
-{
- if(ap==NULL) return;
- ap->count--;
- if(ap->count<=0){
- free(ap);
- }
-}
-
-void access_policy_list_free(AccessPolicy *ap)
-{
- if(ap==NULL) return;
- ap->count--;
- if(ap->count<=0){
- community_list_free(ap->first_community);
- free(ap);
- }
-}
-
-void access_server_delete(AccessServer *as)
-{
- if(as==NULL) return;
- access_policy_list_delete(as->first_acc_policy);
- free(as);
-}
-
-void access_server_free(AccessServer *as)
-{
- if(as==NULL) return;
- access_policy_list_free(as->first_acc_policy);
- free(as);
-}
-
-void agent_manager_list_free(Manager *mgr)
-{
- Manager *nextmgr;
- AccessServer *as, *last=NULL;
-
- if (mgr == NULL)
- return;
-
- while(mgr)
- {
- nextmgr = mgr->next_manager;
-
- as = mgr->first_acc_server;
- while (as) {
- last = as->next_acc_server;
- access_server_delete(as);
- as = last;
- }
-
- if(mgr->name)
- free(mgr->name);
-
- free(mgr);
-
- mgr = nextmgr;
- }
-
- mgr = NULL;
-}
-
-void access_server_add_tail(Manager* mngr, AccessServer *acc_server)
-{
- AccessServer *as, *last=NULL;
-
- if(mngr==NULL || acc_server==NULL) return;
- for(as=mngr->first_acc_server;as;as=as->next_acc_server)
- last = as;
-
- if(last==NULL){
- mngr->first_acc_server = acc_server;
- }else{
- last->next_acc_server = acc_server;
- }
- acc_server->next_acc_server = NULL;
- acc_server->attached = TRUE;
-}
-
-void community_attach(AccessPolicy *ap, Community *comm)
-{
- if(ap==NULL || comm==NULL) return;
- if(ap->first_community==NULL)
- ap->first_community = comm;
- else{
- comm->next_community = ap->first_community;
- ap->first_community = comm;
- }
-}
-
-
-EFilter* efilter_add(char *name, char *error_label)
-{
- EFilter *new;
- EFilter *m;
-
-
- error_label[0] = '\0';
-
-
- if(name == NULL)
- {
- (void)sprintf(error_label, "BUG: efilter_add(): name is NULL");
- return NULL;
- }
-
-
- for(m = first_efilter; m; m = m->next_efilter)
- {
- if(!strcmp(m->name,name))
- {
- return m;
- }
- }
-
-
- /* allocate, initialize and link the new efilter */
- new = (EFilter *) calloc(1,sizeof(EFilter));
- if(new == NULL)
- {
- (void)sprintf(error_label, ERR_MSG_ALLOC);
- return NULL;
- }
- new->next_efilter = NULL;
- new->name = NULL;
-
- new->name = strdup(name);
- if(new->name == NULL)
- {
- (void)sprintf(error_label, ERR_MSG_ALLOC);
- free(new);
- return NULL;
- }
-
- new->enterprise = enterprise_name_to_oid(new->name);
-
- new->next_efilter = first_efilter;
- first_efilter = new;
-
- return new;
-}
-
-TrapSlot* trap_slot_add(int num,EFilter *efilter,char *error_label)
-{
- TrapSlot *new;
- TrapSlot *m;
-
-
- if(efilter==NULL) return NULL;
- if(num < 0)
- {
- (void)sprintf(error_label, "BUG: trap_slot_add(): name is NULL");
- return NULL;
- }
-
-
- for(m = efilter->first_trap_slot; m; m = m->next_trap_slot)
- {
- if(m->num == num)
- {
- return m;
- }
- }
-
-
- /* allocate, initialize and link the new efilter */
- new = (TrapSlot *) calloc(1,sizeof(TrapSlot));
- if(new == NULL)
- {
- (void)sprintf(error_label, ERR_MSG_ALLOC);
- return NULL;
- }
- new->num = num;
- new->next_trap_slot = efilter->first_trap_slot;
- efilter->first_trap_slot = new;
-
- return new;
-}
-
-void sub_group_add_tail(TrapSlot *slot, SubGroup *group)
-{
- SubGroup *sg, *last =NULL;
-
- if(slot==NULL || group==NULL) return;
- for(sg=slot->first_sub_group;sg;sg=sg->next_sub_group)
- last = sg;
-
- if(last==NULL){
- slot->first_sub_group = group;
- }else{
- last->next_sub_group = group;
- }
- group->next_sub_group = NULL;
-}
-
-void mem_filter_join(int low, int high,SubMember *mem,EFilter *filter)
-{
- /* find the trap slot in the filter */
- /* create subgroup, attach submember to subgroup */
- /* insert subgroup into the trap slot */
-
- int idx;
- TrapSlot *slot;
- SubGroup *group;
-
- if(low<0 || high<0 || filter==NULL || mem==NULL) return;
- for(idx=low;idx<=high;idx++){
- slot = trap_slot_add(idx,filter,error_label);
- if(slot==NULL) continue;
- group = calloc(1,sizeof(SubGroup));
- if(group==NULL){
- error("malloc() failed");
- }
- /* The efilter list may contain duplicate entries because
- the agent ACL file may be read several times. This seems
- to be necessary to mantain other functionality in the ACL
- such as specifying managers. The following hack makes sure
- the trap is sent to each host only by not allowing duplicate
- members in an efilter.
- */
- if (slot->first_sub_group == NULL) { /* always add initial first_sub_group */
- sub_group_add_tail(slot,group);
- group->first_sub_member = mem;
- mem->count++;
- }else { /* at least one sub_group exists */
- if (strcmp(slot->first_sub_group->first_sub_member->first_manager->name,
- mem->first_manager->name)) { /* check for duplicate member */
- sub_group_add_tail(slot,group);
- group->first_sub_member = mem;
- mem->count++;
- } else /* don't add duplicate */
- free(group);
- }
- }
-}
-
-static void trace_hosts(Manager *mngr)
-{
- Manager *m;
-
- for(m=mngr;m;m=m->next_manager){
- trace("\t\t%s %s\n",
- m->name,
- inet_ntoa(m->ip_address));
- }
-}
-
-static void trace_sub_member(SubMember *mem)
-{
- if(mem==NULL) return;
- if(mem->community_string != NULL)
- trace("\tcommunity-string: %s\n",mem->community_string);
- trace_hosts(mem->first_manager);
-}
-
-static void trace_sub_group(SubGroup *group)
-{
- if(group==NULL) return;
- trace_sub_member(group->first_sub_member);
-}
-
-static void trace_trap_slot(TrapSlot *slot)
-{
- SubGroup *group;
-
- if(slot==NULL) return;
- trace("\ttrap-num=%d",slot->num);
- for(group=slot->first_sub_group;group;group=group->next_sub_group)
- trace_sub_group(group);
-}
-
-void trace_filter()
-{
- EFilter *filter;
- TrapSlot *slot;
-
- trace("#EFILTER:\n");
- for(filter=first_efilter;filter;filter=filter->next_efilter)
- {
- trace("enterprise=\"%s\"\n",filter->name);
- for(slot=filter->first_trap_slot;slot;slot=slot->next_trap_slot)
- trace_trap_slot(slot);
- }
- trace("\n");
-}
-
-/**** Enterprise related functions *****/
-
-void trace_name_oid_pair()
-{
- NameOidPair *np;
-
- trace("NAME_OID_PAIR:\n");
- for(np=first_name_oid_pair;np;np=np->next)
- trace("name: %s oid: %s\n",np->name,SSAOidString(np->oid));
- trace("\n");
-}
-
-Oid *enterprise_name_to_oid(char *name)
-{
- NameOidPair *np;
-
- if(name == NULL) return NULL;
- for(np=first_name_oid_pair;np;np=np->next){
- if(np->name!=NULL && !strcmp(name,np->name))
- return np->oid;
- }
- return NULL;
-}
-
-static NameOidPair* set_name_and_oid_pair(char *inbuf)
-{
- char *str;
- char *name_str, *oid_str;
- Oid *oid = NULL;
- NameOidPair *np;
-
- if ((inbuf== NULL) || (inbuf[0]== '#')) return NULL;
-
- /* first " for name */
- if ((str = strchr(inbuf, '"')) == NULL) return NULL;
- str++;
- name_str = str;
-
- /* second " for name */
- if ((str = strchr(str, '"')) == NULL) return NULL;
- *str = '\0';
-
- str++;
- /* first " for oid_str*/
- if ((str = strchr(str, '"')) == NULL) return NULL;
- str++;
- oid_str = str;
-
- /* second " for oid_str*/
- if ((str = strchr(str, '"')) == NULL) return NULL;
- *str = '\0';
- oid = SSAOidStrToOid(oid_str,error_label);
-
- np = calloc(1,sizeof(NameOidPair));
- if(np==NULL){
- error("calloc failed");
- return NULL;
- }
- np->oid = oid;
- np->name = strdup(name_str);
-
- if (np->name == NULL) {
- free(np);
- return(NULL);
- }
-
- return np;
-}
-
-static void insert_name_oid_pair(char *name_str,char* oid_str)
-{
- char inbuf[MAX_BUF_SIZE];
- NameOidPair *np;
-
- (void)sprintf(inbuf,"\"%s\" \"%s\"\n",name_str,oid_str);
- if( (np=set_name_and_oid_pair(inbuf)) != NULL){
- np->next = first_name_oid_pair;
- first_name_oid_pair = np;
- }
-}
-
-void load_enterprise_oid(char* filename)
-{
- FILE *fd;
- char inbuf[MAX_BUF_SIZE];
- NameOidPair *np;
-
- if(filename==NULL) return;
- fd = fopen(filename,"r");
- if(fd==NULL){
- error("can open the file %s",filename);
- return;
- }
- while(fgets(inbuf,MAX_BUF_SIZE,fd)){
- if( (np=set_name_and_oid_pair(inbuf)) != NULL){
- /* insert np */
- np->next = first_name_oid_pair;
- first_name_oid_pair = np;
- }
- }
- /* insert a couple of extra name-oid pairs:
- sun, snmp
- */
- insert_name_oid_pair("snmp", "1.3.6.1.2.1.11");
- insert_name_oid_pair("sun", "1.3.6.1.4.1.42.2.1.1");
-
- (void)fclose(fd);
-}
-
-static EFilter* find_efilter(Oid* oid)
-{
- EFilter *filter;
-
- for(filter=first_efilter;filter;filter=filter->next_efilter)
- {
- if(SSAOidCmp(filter->enterprise,oid)==0) return filter;
- }
- return NULL;
-}
-
-static TrapSlot* find_trap_slot(int num,EFilter *filter)
-{
- TrapSlot *slot;
-
- for(slot=filter->first_trap_slot;slot;slot=slot->next_trap_slot)
- if(slot->num==num) return slot;
- return NULL;
-}
-
-void trap_filter_action(Oid *oid,int generic,int specific,
- uint32_t time_stamp,SNMP_variable *variables)
-{
- EFilter *filter;
- TrapSlot *slot;
- SubGroup *group;
- Manager *manager;
- static Subid snmp_subids[] = {1,3,6,1,2,1,11};
- static Oid snmp_oid = {snmp_subids, 7};
- int trap_num;
- IPAddress my_ip_address;
-
- (void)memset(&my_ip_address, 0, sizeof(IPAddress));
-
- if(oid==NULL) return;
- if( (filter=find_efilter(oid))==NULL ) return;
- if(SSAOidCmp(oid,&snmp_oid)==0)
- trap_num = generic;
- else
- trap_num = specific;
- if( (slot=find_trap_slot(trap_num,filter))==NULL ) return;
- for(group=slot->first_sub_group;group;group=group->next_sub_group){
- if(group->first_sub_member!=NULL){
- for(manager=group->first_sub_member->first_manager;manager;
- manager=manager->next_manager){
- trap_send_raw(&(manager->ip_address),my_ip_address,
- group->first_sub_member->community_string,0,
- oid,generic,specific, SNMP_TRAP_PORT,time_stamp,
- variables,error_label);
- }
- }
- }
-}
-
View
186 usr/src/cmd/agents/snmp/agent/access.h
@@ -1,186 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include "impl.h"
-#include "pdu.h"
-
-#ifndef _ACCESS_H_
-#define _ACCESS_H_
-
-#define READ_ONLY 1
-#define READ_WRITE 2
-
-typedef struct _Community {
- struct _Community *next_community;
- char *name;
- int type;
-} Community;
-
-typedef struct _AccessPolicy {
- Community *first_community;
- int access_type; /* one access type for all the communities */
- int count;
-} AccessPolicy;
-
-typedef struct _AccessServer {
- struct _AccessServer *next_acc_server;
- AccessPolicy *first_acc_policy;
- int attached;
-} AccessServer;
-
-typedef struct _Manager {
- struct _Manager *next_manager;
- char *name;
- IPAddress ip_address;
- AccessServer *first_acc_server;
-} Manager;
-
-/****************************************************
-
---------------
-| Manager |-->
-| xxxxxxx |
-| :name |
-| :ip_address |
---------------
- |
- V
----------- -------------- -------------
-| Manager |-->| AccessServer |-->| AccessServer|-->
----------- -------------- -------------
- | 0
- 0 (link to shared object)
- V V
- ------------- --------- ---------
- |AccessPolicy|-->|Community|-->|Community|-->
- |xxxxxxxxxxxx| |xxxxxxxxx| ---------
- |:access_type| |:name |
- ------------- ---------
-1
-******************************************************/
-typedef struct _SubMember {
- Manager *first_manager;
- char *community_string;
- int count;
-} SubMember;
-
-typedef struct _SubGroup {
- struct _SubGroup *next_sub_group;
- SubMember *first_sub_member;
-} SubGroup;
-
-typedef struct _TrapSlot {
- struct _TrapSlot *next_trap_slot;
- SubGroup *first_sub_group;
- int num;
-} TrapSlot;
-
-typedef struct _EFilter {
- struct _EFilter *next_efilter;
- TrapSlot *first_trap_slot;
- Oid *enterprise;
- char *name;
- int type; /* generic or specific */
-} EFilter;
-
-/****************************************************
-
---------------
-| EFilter |-->
-| xxxxxxx |
-| :enterprise |
---------------
- | next_efilter
- V
----------- first_trap_slot ----------- next_trap_slot ---------
-|EFilter |--------------->| TrapSlot |---------------->| TrapSlot|-->
----------- | xxxxxxxxx | ---------
- | | : num |
- V -----------
- | first_sub_group
- V
- ------------------ ------------
- | SubGroup |next_sub_group | SubGroup |
- | xxxxxxxxxxxxxxxx|--------------> ----------
- ------------------
- 0 first_sub_member
- 0
- V
- -----------------
- | SubMember |first_manager ---------
- | xxxxxxxxxxxxxxx |------------>| Manager |
- |:community_string| ---------
- -----------------
-
-******************************************************/
-typedef struct _NameOidPair {
- struct _NameOidPair *next;
- char *name;
- Oid *oid;
-} NameOidPair;
-
-/* routines for trap */
-extern EFilter* efilter_add(char* name, char *error_label);
-extern TrapSlot* trap_slot_add(int num,EFilter *efilter,char *error_label);
-extern void sub_group_add_tail(TrapSlot *slot,SubGroup *group);
-extern void sub_member_free(SubMember *mem);
-extern void sub_group_list_free(SubGroup *group);
-extern void trap_slot_list_free(TrapSlot *slot);
-extern void mem_filter_join(int low,int high,SubMember *mem,EFilter *filter);
-extern void trace_filter();
-
-extern void init_manager_set();
-extern Manager* get_curr_manager_set();
-extern Manager* manager_add(char *name, char *error_label);
-extern Manager* is_valid_manager(Address *address, Manager **mngr);
-extern void delete_manager_list();
-extern void manager_list_free(Manager *mngr);
-extern void trace_managers();
-
-extern int community_add(char *name, int type, char *error_label);
-extern int is_valid_community(char *name, int type, Manager *mngr);
-extern void delete_community_list();
-extern void trace_communities(Community *c);
-extern void trace_access_server(AccessServer *as);
-extern void trace_access_policy(AccessPolicy *ap);
-
-extern void community_attach(AccessPolicy *ap, Community *comm);
-extern void access_server_add_tail(Manager* mngr, AccessServer *acc_server);
-extern void access_server_free(AccessServer *as);
-extern void access_policy_list_free(AccessPolicy *ap);
-extern int get_access_type(Manager *mngr,char *name);
-
-/* name oid pair loading */
-extern void trace_name_oid_pair();
-extern Oid *enterprise_name_to_oid(char *name);
-extern void load_enterprise_oid(char* filename);
-
-extern void trap_filter_action(Oid *oid,int generic,int specific,
- uint32_t time_stamp,SNMP_variable *variables);
-
-#endif
View
90 usr/src/cmd/agents/snmp/agent/agent-mapfile-vers
@@ -1,90 +0,0 @@
-#
-# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-# usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-$mapfile_version 2
-
-SYMBOL_VERSION SUNW_1.1 {
- global:
- SSAMain;
- SSARegSubagent;
- SSAGetTrapPort;
- SSASubagentOpen;
- _SSASendTrap;
- _SSASendTrap2;
- _SSASendTrap3;
- SSAAgentIsAlive;
- SSARegSubtree;
- numTrapElem;
- callItem;
- trapTableMap;
- trapBucket;
- numCallItem;
- trapEnterpriseInfo;
- trapAnyEnterpriseInfo;
- local:
- *;
-};
-
-SYMBOL_VERSION SUNWprivate_1.1 {
- global:
- load_enterprise_oid;
- delete_manager_list;
- access_policy_list_free;
- delete_community_list;
- trace_managers;
- mem_filter_join;
- trap_filter_action;
- access_server_add_tail;
- access_server_free;
- init_manager_set;
- set_first_manager;
- get_curr_manager_set;
- manager_list_free;
- sub_member_free;
- agent_process;
- efilter_add;
- manager_add;
- community_attach;
- trace_filter;
- get_access_type;
- is_valid_manager;
- is_valid_community;
- agent_manager_list_free;
- _SSASendTrap4;
- local:
- *;
-};
View
1,446 usr/src/cmd/agents/snmp/agent/agent.c
@@ -1,1446 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-
-#include "impl.h"
-#include "error.h"
-#include "trace.h"
-#include "snmp.h"
-#include "pdu.h"
-#include "request.h"
-#include "trap.h"
-
-#include "node.h"
-#include "access.h"
-
-static int ssa_mem_free = 1; /* on */
-
-#if defined(_LP64)
-#define COLUMN_OFFSET(x) (x) * 2
-#else
-#define COLUMN_OFFSET(x) (x)
-#endif
-
-#define OCTET_STRING 2
-
-/***** LOCAL VARIABLES *****/
-
-/*
- * The idea of these cache variables is to avoid to call
- * the same *(entry->get) function for variables contained
- * in a single SNMP PDU.
- *
- * There is still a problem in this mechanism.
- * When you query a whole table row by row and when
- * you reached the end of the table, the *(entry->get)
- * will be called several times:
- * - for the first column, *(entry->get) will be called
- * once to find that the end of the table is reached
- * (==> the knowledge that we reached the last row is cached)
- * and then *(entry->get) will be called on the first row of
- * the same table (==> the first row is cached).
- * - Same behaviour for all the remaining columns
- *
- * Possible solutions:
- * - two caches but this implies the copy of the cached
- * structures + all theis pointers
- * - only one cache + caching the knowledge that we reached the last
- * row ???
- *
- */
-
-static Entry *cache_input_entry = NULL;
-static Subid cache_input_index[MAX_OID_LEN];
-static void *cache_output_pointer = NULL;
-static int cache_output_snmp_error = -1;
-static Subid cache_output_index[MAX_OID_LEN];
-
-
-/***** LOCAL FUNCTIONS *****/
-
-static int agent_get_next(SNMP_pdu *pdu, char *error_label);
-static int agent_get_next_loop(SNMP_variable *variable, Node *node, Oid *suffix);
-static int agent_get(SNMP_pdu *pdu, char *error_label);
-static int agent_set(int pass, SNMP_pdu *pdu, char *error_label);
-
-
-/****************************************************************/
-
-/* returns: */
-/* 0 in case of success (the pdu should be sent */
-/* back to its originator even if an SNMP error */
-/* was detected) */
-/* -1 in case of failure (no pdu should be sent */
-/* back) */
-
-int agent_process(Address *address, SNMP_pdu *pdu)
-{
- int snmpEnableAuthTraps = FALSE;
- Manager *mngr;
-
-
- if(pdu == NULL)
- {
- error("BUG: agent_process(): pdu is NULL");
- return -1;
- }
-
-
- /* check host */
- if(is_valid_manager(address,&mngr) == NULL)
- {
- error("agent_process(): unauthorized manager (%s)",
- ip_address_string(&(address->sin_addr)));
-
- snmpEnableAuthTraps = request_snmpEnableAuthTraps(error_label);
- switch(snmpEnableAuthTraps)
- {
- case TRUE:
- if(trap_send_to_all_destinators(NULL,
- SNMP_TRAP_AUTHFAIL, 0,
- NULL, error_label))
- {
- error("trap_send_to_all_destinators() failed: %s\n",
- error_label);
- }
- break;
-
- case FALSE:
- default:
- break;
- }
-
- return -1;
- }
-
- /* if mngr == NULL -> allow requests from any hosts */
-
- /* check pdu type */
- if(pdu->type != GETNEXT_REQ_MSG
- && (pdu->type != GET_REQ_MSG)
- && (pdu->type != SET_REQ_MSG) )
- {
- error("agent_process(): bad PDU type (0x%x)", pdu->type);
- return -1;
- }
-
-
- /* check host */
- if(!is_valid_community(pdu->community, pdu->type,mngr))
- {
- /*
- * Earlier, the community name is displayed here
- * in this error message. But since these error
- * messages are readable by all users, it is not advisible
- * to display community names in the error messages.
- */
- error("agent_process() : bad community from %s",
- ip_address_string(&(address->sin_addr)));
-
- snmpEnableAuthTraps = request_snmpEnableAuthTraps(error_label);
- switch(snmpEnableAuthTraps)
- {
- case TRUE:
- if(trap_send_to_all_destinators(NULL,
- SNMP_TRAP_AUTHFAIL, 0,
- NULL, error_label))
- {
- error("trap_send_to_all_destinators() failed: %s\n",
- error_label);
- }
- break;
-
- case FALSE:
- default:
- break;
- }
-
- return -1;
- }
-
-
- if(cache_input_entry != NULL && cache_output_pointer != NULL)
- if(ssa_mem_free != 0 && cache_input_entry->dealloc != NULL){
- (*(cache_input_entry->dealloc))(cache_output_pointer);
- cache_output_pointer = NULL;
- }
-
- cache_input_entry = NULL;
-
- switch(pdu->type)
- {
- case GETNEXT_REQ_MSG:
- if(agent_get_next(pdu, error_label))
- {
- error("agent_get_next() failed: %s", error_label);
- return -1;
- }
- return 0;
-
- case GET_REQ_MSG:
- if(agent_get(pdu, error_label))
- {
- error("agent_get() failed: %s", error_label);
- return -1;
- }
- return 0;
-
- case SET_REQ_MSG:
- switch(agent_set(FIRST_PASS, pdu, error_label))
- {
- case 0:
- switch(agent_set(SECOND_PASS, pdu, error_label))
- {
- case 0:
- case 1:
- return 0;
-
- case -1:
- error("agent_set(SECOND_PASS) failed: %s",
- error_label);
- return -1;
- }
-
- /* never reached */
- break;
-
- case 1:
- return 0;
-
- case -1:
- error("agent_set(FIRST_PASS) failed: %s",
- error_label);
- return -1;
- }
- }
-
- /* never reached */
- return -1;
-}
-
-
-/****************************************************************/
-
-/* returns: */
-/* 0 in case of success (the pdu should be sent */
-/* back to its originator even if an SNMP error */
-/* was detected) */
-/* -1 in case of failure (no pdu should be sent */
-/* back) */
-
-static int agent_get_next(SNMP_pdu *pdu, char *error_label)
-{
- SNMP_variable *variable;
- Node *node;
- Oid suffix;
- int index = 1;
- int snmp_error;
-
-
- error_label[0] = '\0';
-
- pdu->type = GET_RSP_MSG;
-
- for(variable = pdu->first_variable; variable; variable = variable->next_variable)
- {
- node = node_find(NEXT_ENTRY, &(variable->name), &suffix);
- if(node == NULL)
- {
- pdu->error_status = SNMP_ERR_NOSUCHNAME;
- pdu->error_index = index;
- return 0;
- }
- /* we should not forget to free suffix.subids */
-
- if(trace_level > 0)
- {