169
169
netsnmp_sess_log_error(LOG_WARNING, buf, &sess);
172
#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN
173
if (t->domain == netsnmp_UnixDomain && t->local != NULL) {
174
char name[sizeof(struct sockaddr_un) + 1];
175
memcpy(name, t->local, t->local_length);
176
name[t->local_length] = '\0';
178
* Apply any settings to the ownership/permissions of the
182
netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
183
NETSNMP_DS_AGENT_X_SOCK_PERM);
185
netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
186
NETSNMP_DS_AGENT_X_SOCK_USER);
188
netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
189
NETSNMP_DS_AGENT_X_SOCK_GROUP);
191
if (agentx_sock_perm != 0)
192
chmod(name, agentx_sock_perm);
194
if (agentx_sock_user || agentx_sock_group) {
196
* If either of user or group haven't been set,
197
* then leave them unchanged.
199
if (agentx_sock_user == 0 )
200
agentx_sock_user = -1;
201
if (agentx_sock_group == 0 )
202
agentx_sock_group = -1;
203
chown(name, agentx_sock_user, agentx_sock_group);
173
208
snmp_add_full(&sess, t, NULL, agentx_parse, NULL, NULL,
174
209
agentx_realloc_build, agentx_check_packet, NULL);
176
211
if (session == NULL) {
177
212
netsnmp_transport_free(t);
180
#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN
182
* Apply any settings to the ownership/permissions of the AgentX socket
184
agentx_sock_perm = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
185
NETSNMP_DS_AGENT_X_SOCK_PERM);
186
agentx_sock_user = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
187
NETSNMP_DS_AGENT_X_SOCK_USER);
188
agentx_sock_group = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
189
NETSNMP_DS_AGENT_X_SOCK_GROUP);
191
if (agentx_sock_perm != 0)
192
chmod(sess.peername, agentx_sock_perm);
193
if (agentx_sock_user || agentx_sock_group) {
195
* If either of user or group haven't been set,
196
* then leave them unchanged.
198
if (agentx_sock_user == 0 )
199
agentx_sock_user = -1;
200
if (agentx_sock_group == 0 )
201
agentx_sock_group = -1;
202
chown(sess.peername, agentx_sock_user, agentx_sock_group);
207
216
SNMP_FREE(agentx_sockets);
339
348
for (request = requests, i = 1; request;
340
349
request = request->next, i++) {
341
if (request->index == pdu->errindex) {
350
if (i == pdu->errindex) {
343
* mark this one as the one generating the error
352
* Mark this varbind as the one generating the error.
353
* Note that the AgentX errindex may not match the
354
* position in the original SNMP PDU (request->index)
345
356
netsnmp_set_request_error(cache->reqinfo, request,
443
454
netsnmp_request_info *request = requests;
444
455
netsnmp_pdu *pdu;
447
459
DEBUGMSGTL(("agentx/master",
448
460
"agentx master handler starting, mode = 0x%02x\n",
606
618
DEBUGMSGTL(("agentx", "sending pdu (req=0x%x,trans=0x%x,sess=0x%x)\n",
607
619
pdu->reqid,pdu->transid, pdu->sessid));
608
snmp_async_send(ax_session, pdu, agentx_got_response, cb_data);
620
result = snmp_async_send(ax_session, pdu, agentx_got_response, cb_data);
623
snmp_free_pdu( pdu );
610
626
return SNMP_ERR_NOERROR;