X-Git-Url: http://developer.intra2net.com/git/?p=libipt_ACCOUNT;a=blobdiff_plain;f=src%2Fipt_ACCOUNT_cl.c;h=17a42c3ea998ca569f7c9ed0ae036d4955cb03b9;hp=1791eaa804d865f61d8bb82443aa8a4312d8b6aa;hb=HEAD;hpb=e3ccc02f6d76e1c1495370812fd790fd84c7cab1 diff --git a/src/ipt_ACCOUNT_cl.c b/src/ipt_ACCOUNT_cl.c index 1791eaa..17a42c3 100644 --- a/src/ipt_ACCOUNT_cl.c +++ b/src/ipt_ACCOUNT_cl.c @@ -8,6 +8,7 @@ * * ***************************************************************************/ +#include #include #include @@ -16,9 +17,13 @@ #include #include +#include +#include + int ipt_ACCOUNT_init(struct ipt_ACCOUNT_context *ctx) { memset (ctx, 0, sizeof(struct ipt_ACCOUNT_context)); + ctx->handle.handle_nr = -1; ctx->sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); if (ctx->sockfd < 0) { @@ -68,6 +73,7 @@ int ipt_ACCOUNT_read_entries(struct ipt_ACCOUNT_context *ctx, const char *table, char dont_flush) { unsigned int s = sizeof (struct ipt_acc_handle_sockopt); + unsigned int new_size; int rtn; strncpy(ctx->handle.name, table, ACCOUNT_TABLE_NAME_LEN-1); @@ -88,7 +94,6 @@ int ipt_ACCOUNT_read_entries(struct ipt_ACCOUNT_context *ctx, // Check data buffer size ctx->pos = 0; - unsigned int new_size; new_size = ctx->handle.itemcount * sizeof(struct ipt_acc_handle_ip); // We want to prevent reallocations all the time if (new_size < IPT_ACCOUNT_MIN_BUFSIZE) @@ -152,6 +157,7 @@ int ipt_ACCOUNT_get_handle_usage(struct ipt_ACCOUNT_context *ctx) ctx->error_str = "Can't get handle usage information from kernel"; return -1; } + ctx->handle.handle_nr = -1; return ctx->handle.itemcount; } @@ -183,10 +189,11 @@ int ipt_ACCOUNT_get_table_names(struct ipt_ACCOUNT_context *ctx) const char *ipt_ACCOUNT_get_next_name(struct ipt_ACCOUNT_context *ctx) { + const char *rtn; if (((char *)ctx->data)[ctx->pos] == 0) return 0; - const char *rtn = ctx->data + ctx->pos; + rtn = ctx->data + ctx->pos; ctx->pos += strlen(ctx->data+ctx->pos) + 1; return rtn;