mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-11-27 02:22:00 +08:00
Rework Modify statslog too
This commit is contained in:
parent
103ff9a7fc
commit
8f78c96417
@ -131,36 +131,42 @@ do_modify(
|
||||
}
|
||||
|
||||
if ( StatslogTest( LDAP_DEBUG_STATS ) ) {
|
||||
char abuf[BUFSIZ/2], *ptr = abuf;
|
||||
int len = 0;
|
||||
char *ptr;
|
||||
unsigned len = 0, alen;
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s MOD dn=\"%s\"\n",
|
||||
op->o_log_prefix, op->o_req_dn.bv_val, 0, 0, 0 );
|
||||
ptr = op->o_logptr;
|
||||
ptr += snprintf( ptr, LOGBUFSIZ - (ptr - op->o_logbuf),
|
||||
" MOD dn=\"%s\"\n",
|
||||
op->o_req_dn.bv_val );
|
||||
|
||||
for ( tmp = op->orm_modlist; tmp != NULL; tmp = tmp->sml_next ) {
|
||||
if (len + 1 + tmp->sml_type.bv_len > sizeof(abuf)) {
|
||||
Statslog( LDAP_DEBUG_STATS, "%s MOD attr=%s\n",
|
||||
op->o_log_prefix, abuf, 0, 0, 0 );
|
||||
|
||||
len = 0;
|
||||
ptr = abuf;
|
||||
|
||||
if( 1 + tmp->sml_type.bv_len > sizeof(abuf)) {
|
||||
Statslog( LDAP_DEBUG_STATS, "%s MOD attr=%s\n",
|
||||
op->o_log_prefix, tmp->sml_type.bv_val, 0, 0, 0 );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (len) {
|
||||
*ptr++ = ' ';
|
||||
len++;
|
||||
}
|
||||
ptr = lutil_strcopy(ptr, tmp->sml_type.bv_val);
|
||||
len += tmp->sml_type.bv_len;
|
||||
len = ptr - op->o_logbuf;
|
||||
if ( op->orm_modlist ) {
|
||||
ptr += snprintf( ptr, LOGBUFSIZ - len, " MOD attr=" );
|
||||
len = ptr - op->o_logbuf;
|
||||
}
|
||||
if (len) {
|
||||
Statslog( LDAP_DEBUG_STATS, "%s MOD attr=%s\n",
|
||||
op->o_log_prefix, abuf, 0, 0, 0 );
|
||||
for ( tmp = op->orm_modlist; tmp != NULL; tmp = tmp->sml_next ) {
|
||||
alen = tmp->sml_type.bv_len;
|
||||
if ( alen >= 256 )
|
||||
alen = 255;
|
||||
if (len + 1 + alen >= LOGBUFSIZ ) {
|
||||
if ( ldap_debug & LDAP_DEBUG_STATS )
|
||||
lutil_debug( ldap_debug, LDAP_DEBUG_STATS, "%s", op->o_log_prefix );
|
||||
if ( ldap_syslog & LDAP_DEBUG_STATS )
|
||||
sendlog( op->o_logbuf, ptr - op->o_logbuf );
|
||||
ptr = lutil_strcopy( op->o_logptr, " MOD attr=" );
|
||||
len = ptr - op->o_logbuf;
|
||||
}
|
||||
ptr = lutil_strncopy( ptr, tmp->sml_type.bv_val, alen );
|
||||
len += alen;
|
||||
*ptr++ = ' ';
|
||||
*ptr = '\0';
|
||||
}
|
||||
if ( ptr != op->o_logptr ) {
|
||||
if ( ldap_debug & LDAP_DEBUG_STATS )
|
||||
lutil_debug( ldap_debug, LDAP_DEBUG_STATS, "%s", op->o_log_prefix );
|
||||
if ( ldap_syslog & LDAP_DEBUG_STATS )
|
||||
sendlog( op->o_logbuf, ptr - op->o_logbuf );
|
||||
*op->o_logptr = '\0';
|
||||
}
|
||||
}
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
@ -156,6 +156,7 @@ sendlog(char *tbuf, int cnt)
|
||||
openlog(LogTag, LogStat, 0);
|
||||
connectlog();
|
||||
|
||||
#if 1
|
||||
/*
|
||||
* If the send() failed, there are two likely scenarios:
|
||||
* 1) syslogd was restarted
|
||||
@ -175,6 +176,7 @@ sendlog(char *tbuf, int cnt)
|
||||
break;
|
||||
} while (errno == ENOBUFS);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user