/* collect all crd data and write it to a syslog */ static int log_write_cdr( struct dlg_cell* dialog, struct sip_msg* message) { static char cdr_message[ MAX_SYSLOG_SIZE]; static char* const cdr_message_end = cdr_message + MAX_SYSLOG_SIZE - 2;// -2 because of the string ending '\n\0' char* message_position = NULL; int message_index = 0; int extra_index = 0; int counter = 0; if(cdr_log_enable==0) return 0; /* get default values */ message_index = cdr_core2strar( dialog, cdr_value_array, cdr_int_array, cdr_type_array); /* get extra values */ if (message) { extra_index += extra2strar( cdr_extra, message, cdr_value_array + message_index, cdr_int_array + message_index, cdr_type_array + message_index); } else if (cdr_expired_dlg_enable){ LM_DBG("fallback to dlg_only search because of message does not exist.\n"); message_index += extra2strar_dlg_only( cdr_extra, dialog, cdr_value_array + message_index, cdr_int_array + message_index, cdr_type_array + message_index, &dlgb); } message_index += extra_index; for( counter = 0, message_position = cdr_message; counter < message_index ; counter++ ) { const char* const next_message_end = message_position + 2 + // ', ' -> two letters cdr_attrs[ counter].len + 1 + // '=' -> one letter cdr_value_array[ counter].len; if( next_message_end >= cdr_message_end || next_message_end < message_position) { LM_WARN("cdr message too long, truncating..\n"); message_position = cdr_message_end; break; } if( counter > 0) { *(message_position++) = A_SEPARATOR_CHR; *(message_position++) = A_SEPARATOR_CHR_2; } memcpy( message_position, cdr_attrs[ counter].s, cdr_attrs[ counter].len); message_position += cdr_attrs[ counter].len; *( message_position++) = A_EQ_CHR; memcpy( message_position, cdr_value_array[ counter].s, cdr_value_array[ counter].len); message_position += cdr_value_array[ counter].len; } /* terminating line */ *(message_position++) = '\n'; *(message_position++) = '\0'; LM_GEN2( cdr_facility, log_level, "%s", cdr_message); /* free memory allocated by extra2strar, nothing is done in case no extra strings were found by extra2strar */ free_strar_mem( &(cdr_type_array[message_index-extra_index]), &(cdr_value_array[message_index-extra_index]), extra_index, message_index); return 0; }
int acc_radius_send_request(struct sip_msg *req, acc_info_t *inf) { int attr_cnt; VALUE_PAIR *send; uint32_t av_type; int offset; int i; int m=0; int o=0; int rc_result=-1; double tsecmicro; char smicrosec[18]; send=NULL; attr_cnt = accb.get_core_attrs( req, inf->varr, inf->iarr, inf->tarr ); /* not interested in the last 2 values */ attr_cnt -= 2; av_type = rad_status( req, inf->env->code); /* RADIUS status */ ADD_RAD_AVPAIR( RA_ACCT_STATUS_TYPE, &av_type, -1); av_type = rd_vals[RV_SIP_SESSION].v; /* session*/ ADD_RAD_AVPAIR( RA_SERVICE_TYPE, &av_type, -1); av_type = (uint32_t)inf->env->code; /* status=integer */ ADD_RAD_AVPAIR( RA_SIP_RESPONSE_CODE, &av_type, -1); av_type = req->REQ_METHOD; /* method */ ADD_RAD_AVPAIR( RA_SIP_METHOD, &av_type, -1); // Event Time Stamp with Microseconds if(rad_time_mode==1){ gettimeofday(&inf->env->tv, NULL); tsecmicro=inf->env->tv.tv_sec+((double)inf->env->tv.tv_usec/1000000.0); //radius client doesn t support double so convert it sprintf(smicrosec,"%17.6f",tsecmicro); ADD_RAD_AVPAIR(RA_TIME_STAMP, &smicrosec, -1); }else{ av_type = (uint32_t)inf->env->ts; ADD_RAD_AVPAIR(RA_TIME_STAMP, &av_type, -1); } /* add extra also */ o = accb.get_extra_attrs(rad_extra, req, inf->varr+attr_cnt, inf->iarr+attr_cnt, inf->tarr+attr_cnt); attr_cnt += o; m = attr_cnt; /* add the values for the vector - start from 1 instead of * 0 to skip the first value which is the METHOD as string */ offset = RA_STATIC_MAX-1; for( i=1; i<attr_cnt; i++) { switch (inf->tarr[i]) { case TYPE_STR: ADD_RAD_AVPAIR(offset+i, inf->varr[i].s, inf->varr[i].len); break; case TYPE_INT: ADD_RAD_AVPAIR(offset+i, &(inf->iarr[i]), -1); break; default: break; } } /* call-legs attributes also get inserted */ if ( inf->leg_info ) { offset += attr_cnt; attr_cnt = accb.get_leg_attrs(inf->leg_info,req,inf->varr,inf->iarr,inf->tarr,1); do { for (i=0; i<attr_cnt; i++) ADD_RAD_AVPAIR( offset+i, inf->varr[i].s, inf->varr[i].len ); }while ( (attr_cnt=accb.get_leg_attrs(inf->leg_info,req,inf->varr,inf->iarr, inf->tarr, 0))!=0 ); } rc_result=rc_acct(rh, SIP_PORT, send); if (rc_result==ERROR_RC) { LM_ERR("Radius accounting - ERROR - \n"); goto error; }else if(rc_result==BADRESP_RC){ LM_ERR("Radius accounting - BAD RESPONSE \n"); goto error; }else if(rc_result==TIMEOUT_RC){ LM_ERR("Radius accounting - TIMEOUT \n"); goto error; }else if(rc_result==REJECT_RC){ LM_ERR("Radius accounting - REJECTED \n"); goto error; }else if(rc_result==OK_RC){ LM_DBG("Radius accounting - OK \n"); }else{ LM_ERR("Radius accounting - Unknown response \n"); goto error; } rc_avpair_free(send); /* free memory allocated by extra2strar */ free_strar_mem( &(inf->tarr[m-o]), &(inf->varr[m-o]), o, m); return 1; error: rc_avpair_free(send); /* free memory allocated by extra2strar */ free_strar_mem( &(inf->tarr[m-o]), &(inf->varr[m-o]), o, m); return -1; }
/* collect all crd data and write it to a syslog */ static int db_write_cdr( struct dlg_cell* dialog, struct sip_msg* message) { int m = 0; int n = 0; int i; db_func_t *df=NULL; db1_con_t *dh=NULL; void *vf=NULL; void *vh=NULL; struct timeval timeval_val; long long_val; double double_val; char * end; if(acc_cdrs_table.len<=0) return 0; if(acc_get_db_handlers(&vf, &vh)<0) { LM_ERR("cannot get db handlers\n"); return -1; } df = (db_func_t*)vf; dh = (db1_con_t*)vh; /* get default values */ m = cdr_core2strar( dialog, cdr_value_array, cdr_int_array, cdr_type_array); for(i=0; i<m; i++) { db_cdr_keys[i] = &cdr_attrs[i]; /* reset errno, some strtoX don't reset it */ errno = 0; switch(cdr_type_array[i]) { case TYPE_NULL: VAL_NULL(db_cdr_vals+i)=1; break; case TYPE_INT: VAL_TYPE(db_cdr_vals+i)=DB1_INT; VAL_NULL(db_cdr_vals+i)=0; long_val = strtol(cdr_value_array[i].s, &end, 10); if(errno && (errno != EAGAIN)) { LM_ERR("failed to convert string to integer - %d.\n", errno); goto error; } VAL_INT(db_cdr_vals+i) = long_val; break; case TYPE_STR: VAL_TYPE(db_cdr_vals+i)=DB1_STR; VAL_NULL(db_cdr_vals+i)=0; VAL_STR(db_cdr_vals+i) = cdr_value_array[i]; break; case TYPE_DATE: VAL_TYPE(db_cdr_vals+i)=DB1_DATETIME; VAL_NULL(db_cdr_vals+i)=0; if(string2time(&cdr_value_array[i], &timeval_val) < 0) { LM_ERR("failed to convert string to timeval.\n"); goto error; } VAL_TIME(db_cdr_vals+i) = timeval_val.tv_sec; break; case TYPE_DOUBLE: VAL_TYPE(db_cdr_vals+i)=DB1_DOUBLE; VAL_NULL(db_cdr_vals+i)=0; double_val = strtod(cdr_value_array[i].s, &end); if(errno && (errno != EAGAIN)) { LM_ERR("failed to convert string to double - %d.\n", errno); goto error; } VAL_DOUBLE(db_cdr_vals+i) = double_val; break; } } /* get extra values */ if (message) { n += extra2strar( cdr_extra, message, cdr_value_array + m, cdr_int_array + m, cdr_type_array + m); m += n; } else if (cdr_expired_dlg_enable){ LM_WARN( "fallback to dlg_only search because of message doesn't exist.\n"); m += extra2strar_dlg_only( cdr_extra, dialog, cdr_value_array + m, cdr_int_array + m, cdr_type_array +m, &dlgb); } for( ; i<m; i++) { db_cdr_keys[i] = &cdr_attrs[i]; VAL_TYPE(db_cdr_vals+i)=DB1_STR; VAL_NULL(db_cdr_vals+i)=0; VAL_STR(db_cdr_vals+i) = cdr_value_array[i]; } if (df->use_table(dh, &acc_cdrs_table /*table*/) < 0) { LM_ERR("error in use_table\n"); goto error; } if(acc_db_insert_mode==1 && df->insert_delayed!=NULL) { if (df->insert_delayed(dh, db_cdr_keys, db_cdr_vals, m) < 0) { LM_ERR("failed to insert delayed into database\n"); goto error; } } else if(acc_db_insert_mode==2 && df->insert_async!=NULL) { if (df->insert_async(dh, db_cdr_keys, db_cdr_vals, m) < 0) { LM_ERR("failed to insert async into database\n"); goto error; } } else { if (df->insert(dh, db_cdr_keys, db_cdr_vals, m) < 0) { LM_ERR("failed to insert into database\n"); goto error; } } /* Free memory allocated by acc_extra.c/extra2strar */ free_strar_mem( &(cdr_type_array[m-n]), &(cdr_value_array[m-n]), n, m); return 0; error: /* Free memory allocated by acc_extra.c/extra2strar */ free_strar_mem( &(cdr_type_array[m-n]), &(cdr_value_array[m-n]), n, m); return -1; }
int acc_diameter_send_request(sip_msg_t *req, acc_info_t *inf) { int attr_cnt; int cnt; AAAMessage *send = NULL; AAA_AVP *avp; struct sip_uri puri; str *uri; int ret; int i; int status; char tmp[2]; unsigned int mid; int m; int o; attr_cnt = accb.get_core_attrs(req, inf->varr, inf->iarr, inf->tarr); /* last value is not used */ attr_cnt--; if ( (send=AAAInMessage(ACCOUNTING_REQUEST, AAA_APP_NASREQ))==NULL) { LM_ERR("failed to create new AAA request\n"); return -1; } m = 0; o = 0; /* AVP_ACCOUNTIG_RECORD_TYPE */ if( (status = diam_status(req, inf->env->code))<0) { LM_ERR("status unknown\n"); goto error; } tmp[0] = status+'0'; tmp[1] = 0; if( (avp=AAACreateAVP(AVP_Accounting_Record_Type, 0, 0, tmp, 1, AVP_DUPLICATE_DATA)) == 0) { LM_ERR("failed to create AVP:no more free memory!\n"); goto error; } if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) { LM_ERR("avp not added \n"); AAAFreeAVP(&avp); goto error; } /* SIP_MSGID AVP */ mid = req->id; if( (avp=AAACreateAVP(AVP_SIP_MSGID, 0, 0, (char*)(&mid), sizeof(mid), AVP_DUPLICATE_DATA)) == 0) { LM_ERR("failed to create AVP:no more free memory!\n"); goto error; } if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) { LM_ERR("avp not added \n"); AAAFreeAVP(&avp); goto error; } /* SIP Service AVP */ if( (avp=AAACreateAVP(AVP_Service_Type, 0, 0, SIP_ACCOUNTING, SERVICE_LEN, AVP_DUPLICATE_DATA)) == 0) { LM_ERR("failed to create AVP:no more free memory!\n"); goto error; } if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) { LM_ERR("avp not added \n"); AAAFreeAVP(&avp); goto error; } /* also the extra attributes */ o = accb.get_extra_attrs(diameter_extra, req, inf->varr+attr_cnt, inf->iarr+attr_cnt, inf->tarr+attr_cnt); attr_cnt += o; m = attr_cnt; /* add attributes */ for(i=0; i<attr_cnt; i++) { if((avp=AAACreateAVP(diam_attrs[i], 0,0, inf->varr[i].s, inf->varr[i].len, AVP_DUPLICATE_DATA)) == 0) { LM_ERR("failed to create AVP: no more free memory!\n"); goto error; } if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) { LM_ERR("avp not added \n"); AAAFreeAVP(&avp); goto error; } } /* and the leg attributes */ if ( inf->leg_info ) { cnt = accb.get_leg_attrs(inf->leg_info,req,inf->varr,inf->iarr,inf->tarr,1); do { for (i=0; i<cnt; i++) { if((avp=AAACreateAVP(diam_attrs[attr_cnt+i], 0, 0, inf->varr[i].s, inf->varr[i].len, AVP_DUPLICATE_DATA)) == 0) { LM_ERR("failed to create AVP: no more free memory!\n"); goto error; } if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) { LM_ERR("avp not added \n"); AAAFreeAVP(&avp); goto error; } } } while ( (attr_cnt=accb.get_leg_attrs(inf->leg_info,req,inf->varr,inf->iarr, inf->tarr, 0))!=0 ); } if (get_uri(req, &uri) < 0) { LM_ERR("failed to get uri, From/To URI not found\n"); goto error; } if (parse_uri(uri->s, uri->len, &puri) < 0) { LM_ERR("failed to parse From/To URI\n"); goto error; } /* Destination-Realm AVP */ if( (avp=AAACreateAVP(AVP_Destination_Realm, 0, 0, puri.host.s, puri.host.len, AVP_DUPLICATE_DATA)) == 0) { LM_ERR("failed to create AVP:no more free memory!\n"); goto error; } if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) { LM_ERR("avp not added \n"); AAAFreeAVP(&avp); goto error; } /* prepare the message to be sent over the network */ if(AAABuildMsgBuffer(send) != AAA_ERR_SUCCESS) { LM_ERR("message buffer not created\n"); goto error; } if(sockfd==AAA_NO_CONNECTION) { sockfd = init_mytcp(diameter_client_host, diameter_client_port); if(sockfd==AAA_NO_CONNECTION) { LM_ERR("failed to reconnect to Diameter client\n"); goto error; } } /* send the message to the DIAMETER client */ ret = tcp_send_recv(sockfd, send->buf.s, send->buf.len, rb, req->id); if(ret == AAA_CONN_CLOSED) { LM_NOTICE("connection to Diameter client closed.It will be " "reopened by the next request\n"); close(sockfd); sockfd = AAA_NO_CONNECTION; goto error; } if(ret != ACC_SUCCESS) { /* a transmission error occurred */ LM_ERR("message sending to the DIAMETER backend authorization " "server failed\n"); goto error; } AAAFreeMessage(&send); /* free memory allocated by extra2strar */ free_strar_mem( &(inf->tarr[m-o]), &(inf->varr[m-o]), o, m); return 1; error: AAAFreeMessage(&send); /* free memory allocated by extra2strar */ free_strar_mem( &(inf->tarr[m-o]), &(inf->varr[m-o]), o, m); return -1; }
int acc_rad_request( struct sip_msg *req ) { int attr_cnt; VALUE_PAIR *send; UINT4 av_type; int offset; int i; int m; int o; send=NULL; attr_cnt = core2strar( req, val_arr, int_arr, type_arr ); /* not interested in the last 2 values */ attr_cnt -= 2; av_type = rad_status( req, acc_env.code); /* RADIUS status */ ADD_RAD_AVPAIR( RA_ACCT_STATUS_TYPE, &av_type, -1); av_type = rd_vals[RV_SIP_SESSION].v; /* session*/ ADD_RAD_AVPAIR( RA_SERVICE_TYPE, &av_type, -1); av_type = (UINT4)acc_env.code; /* status=integer */ ADD_RAD_AVPAIR( RA_SIP_RESPONSE_CODE, &av_type, -1); av_type = req->REQ_METHOD; /* method */ ADD_RAD_AVPAIR( RA_SIP_METHOD, &av_type, -1); /* unix time */ av_type = (UINT4)acc_env.ts; ADD_RAD_AVPAIR( RA_TIME_STAMP, &av_type, -1); /* add extra also */ o = extra2strar(rad_extra, req, val_arr+attr_cnt, int_arr+attr_cnt, type_arr+attr_cnt); attr_cnt += o; m = attr_cnt; /* add the values for the vector - start from 1 instead of * 0 to skip the first value which is the METHOD as string */ offset = RA_STATIC_MAX-1; for( i=1; i<attr_cnt; i++) { switch (type_arr[i]) { case TYPE_STR: ADD_RAD_AVPAIR(offset+i, val_arr[i].s, val_arr[i].len); break; case TYPE_INT: ADD_RAD_AVPAIR(offset+i, &(int_arr[i]), -1); break; default: break; } } /* call-legs attributes also get inserted */ if ( leg_info ) { offset += attr_cnt; attr_cnt = legs2strar(leg_info,req,val_arr,int_arr,type_arr,1); do { for (i=0; i<attr_cnt; i++) ADD_RAD_AVPAIR( offset+i, val_arr[i].s, val_arr[i].len ); }while ( (attr_cnt=legs2strar(leg_info,req,val_arr,int_arr, type_arr, 0))!=0 ); } if (rc_acct(rh, SIP_PORT, send)!=OK_RC) { LM_ERR("radius-ing failed\n"); goto error; } rc_avpair_free(send); /* free memory allocated by extra2strar */ free_strar_mem( &(type_arr[m-o]), &(val_arr[m-o]), o, m); return 1; error: rc_avpair_free(send); /* free memory allocated by extra2strar */ free_strar_mem( &(type_arr[m-o]), &(val_arr[m-o]), o, m); return -1; }
int acc_db_request( struct sip_msg *rq) { int m; int n; int i; int o; struct tm *t; /* formated database columns */ m = core2strar( rq, val_arr, int_arr, type_arr ); for(i=0; i<m; i++) VAL_STR(db_vals+i) = val_arr[i]; /* time value */ VAL_TIME(db_vals+(m++)) = acc_env.ts; /* extra time value */ if(acc_time_mode==1) { VAL_INT(db_vals+(m++)) = (int)acc_env.tv.tv_sec; i++; VAL_INT(db_vals+(m++)) = (int)acc_env.tv.tv_usec; i++; } else if(acc_time_mode==2) { VAL_DOUBLE(db_vals+(m++)) = ((double)(acc_env.tv.tv_sec * 1000) + (acc_env.tv.tv_usec / 1000)) / 1000; i++; } else if(acc_time_mode==3 || acc_time_mode==4) { if(acc_time_mode==3) { t = localtime(&acc_env.ts); } else { t = gmtime(&acc_env.ts); } if(strftime(acc_time_format_buf, ACC_TIME_FORMAT_SIZE, acc_time_format, t)<=0) { acc_time_format_buf[0] = '\0'; } VAL_STRING(db_vals+(m++)) = acc_time_format_buf; i++; } /* extra columns */ o = extra2strar( db_extra, rq, val_arr+m, int_arr+m, type_arr+m); m += o; for( i++ ; i<m; i++) VAL_STR(db_vals+i) = val_arr[i]; if (acc_dbf.use_table(db_handle, &acc_env.text/*table*/) < 0) { LM_ERR("error in use_table\n"); goto error; } /* multi-leg columns */ if ( !leg_info ) { if(acc_db_insert_mode==1 && acc_dbf.insert_delayed!=NULL) { if (acc_dbf.insert_delayed(db_handle, db_keys, db_vals, m) < 0) { LM_ERR("failed to insert delayed into database\n"); goto error; } } else if(acc_db_insert_mode==2 && acc_dbf.insert_async!=NULL) { if (acc_dbf.insert_async(db_handle, db_keys, db_vals, m) < 0) { LM_ERR("failed to insert async into database\n"); goto error; } } else { if (acc_dbf.insert(db_handle, db_keys, db_vals, m) < 0) { LM_ERR("failed to insert into database\n"); goto error; } } } else { n = legs2strar(leg_info,rq,val_arr+m,int_arr+m,type_arr+m,1); do { for (i=m; i<m+n; i++) VAL_STR(db_vals+i)=val_arr[i]; if(acc_db_insert_mode==1 && acc_dbf.insert_delayed!=NULL) { if(acc_dbf.insert_delayed(db_handle,db_keys,db_vals,m+n)<0) { LM_ERR("failed to insert delayed into database\n"); goto error; } } else if(acc_db_insert_mode==2 && acc_dbf.insert_async!=NULL) { if(acc_dbf.insert_async(db_handle,db_keys,db_vals,m+n)<0) { LM_ERR("failed to insert async into database\n"); goto error; } } else { if (acc_dbf.insert(db_handle, db_keys, db_vals, m+n) < 0) { LM_ERR("failed to insert into database\n"); goto error; } } }while ( (n=legs2strar(leg_info,rq,val_arr+m,int_arr+m, type_arr+m,0))!=0 ); } /* free memory allocated by extra2strar */ free_strar_mem( &(type_arr[m-o]), &(val_arr[m-o]), o, m); return 1; error: /* free memory allocated by extra2strar */ free_strar_mem( &(type_arr[m-o]), &(val_arr[m-o]), o, m); return -1; }
int acc_log_request( struct sip_msg *rq) { static char log_msg[MAX_SYSLOG_SIZE]; static char *log_msg_end=log_msg+MAX_SYSLOG_SIZE-2; char *p; int n; int m; int o; int i; struct tm *t; /* get default values */ m = core2strar( rq, val_arr, int_arr, type_arr); /* get extra values */ o = extra2strar( log_extra, rq, val_arr+m, int_arr+m, type_arr+m); m += o; for ( i=0,p=log_msg ; i<m ; i++ ) { if (p+1+log_attrs[i].len+1+val_arr[i].len >= log_msg_end) { LM_WARN("acc message too long, truncating..\n"); p = log_msg_end; break; } *(p++) = A_SEPARATOR_CHR; memcpy(p, log_attrs[i].s, log_attrs[i].len); p += log_attrs[i].len; *(p++) = A_EQ_CHR; if (val_arr[i].s != NULL) { memcpy(p, val_arr[i].s, val_arr[i].len); p += val_arr[i].len; } } /* get per leg attributes */ if ( leg_info ) { n = legs2strar(leg_info,rq,val_arr+m,int_arr+m,type_arr+m, 1); do { for (i=m; i<m+n; i++) { if (p+1+log_attrs[i].len+1+val_arr[i].len >= log_msg_end) { LM_WARN("acc message too long, truncating..\n"); p = log_msg_end; break; } *(p++) = A_SEPARATOR_CHR; memcpy(p, log_attrs[i].s, log_attrs[i].len); p += log_attrs[i].len; *(p++) = A_EQ_CHR; if (val_arr[i].s != NULL) { memcpy(p, val_arr[i].s, val_arr[i].len); p += val_arr[i].len; } } } while (p!=log_msg_end && (n=legs2strar(leg_info,rq,val_arr+m, int_arr+m,type_arr+m, 0))!=0); } /* terminating line */ *(p++) = '\n'; *(p++) = 0; if(acc_time_mode==1) { LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu;%s=%u%s", acc_env.text.len, acc_env.text.s,(unsigned long)acc_env.ts, acc_time_exten.s, (unsigned int)acc_env.tv.tv_usec, log_msg); } else if(acc_time_mode==2) { LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu;%s=%.3f%s", acc_env.text.len, acc_env.text.s,(unsigned long)acc_env.ts, acc_time_attr.s, (((double)(acc_env.tv.tv_sec * 1000) + (acc_env.tv.tv_usec / 1000)) / 1000), log_msg); } else if(acc_time_mode==3 || acc_time_mode==4) { if(acc_time_mode==3) { t = localtime(&acc_env.ts); } else { t = gmtime(&acc_env.ts); } if(strftime(acc_time_format_buf, ACC_TIME_FORMAT_SIZE, acc_time_format, t)<=0) { acc_time_format_buf[0] = '\0'; } LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu;%s=%s%s", acc_env.text.len, acc_env.text.s,(unsigned long)acc_env.ts, acc_time_attr.s, acc_time_format_buf, log_msg); } else { LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu%s", acc_env.text.len, acc_env.text.s,(unsigned long)acc_env.ts, log_msg); } /* free memory allocated by extra2strar */ free_strar_mem( &(type_arr[m-o]), &(val_arr[m-o]), o, m); return 1; }