|
|
| version 1.1.1.3, 2016/11/01 09:56:12 | version 1.1.1.4, 2019/10/22 13:49:55 |
|---|---|
| Line 175 ConsoleClose(Console c) | Line 175 ConsoleClose(Console c) |
| return 0; | return 0; |
| } | } |
| void | |
| ConsoleCancelCleanup(void *rwlock) | |
| { | |
| pthread_rwlock_t p = (pthread_rwlock_t)rwlock; | |
| RWLOCK_UNLOCK(p); | |
| } | |
| /* | /* |
| * ConsoleStat() | * ConsoleStat() |
| */ | */ |
| Line 192 ConsoleStat(Context ctx, int ac, char *av[], void *arg | Line 200 ConsoleStat(Context ctx, int ac, char *av[], void *arg |
| Printf("\tIP-Address : %s\r\n", u_addrtoa(&c->addr,addrstr,sizeof(addrstr))); | Printf("\tIP-Address : %s\r\n", u_addrtoa(&c->addr,addrstr,sizeof(addrstr))); |
| Printf("\tPort : %d\r\n", c->port); | Printf("\tPort : %d\r\n", c->port); |
| pthread_cleanup_push(ConsoleCancelCleanup, c->lock); | |
| RWLOCK_RDLOCK(c->lock); | RWLOCK_RDLOCK(c->lock); |
| Printf("Active sessions:\r\n"); | Printf("Active sessions:\r\n"); |
| SLIST_FOREACH(s, &c->sessions, next) { | SLIST_FOREACH(s, &c->sessions, next) { |
| Printf("\tUsername: %s\tFrom: %s\r\n", | Printf("\tUsername: %s\tFrom: %s\r\n", |
| s->user.username, u_addrtoa(&s->peer_addr,addrstr,sizeof(addrstr))); | s->user.username, u_addrtoa(&s->peer_addr,addrstr,sizeof(addrstr))); |
| } | } |
| RWLOCK_UNLOCK(c->lock); | pthread_cleanup_pop(1); |
| Printf("Global options:\r\n"); | Printf("Global options:\r\n"); |
| OptStat(ctx, &c->options, gConfList); | OptStat(ctx, &c->options, gConfList); |
| Line 905 UserStat(Context ctx, int ac, char *av[], void *arg) | Line 914 UserStat(Context ctx, int ac, char *av[], void *arg) |
| ConsoleUser u; | ConsoleUser u; |
| Printf("Configured users:\r\n"); | Printf("Configured users:\r\n"); |
| pthread_cleanup_push(ConsoleCancelCleanup, gUsersLock); | |
| RWLOCK_RDLOCK(gUsersLock); | RWLOCK_RDLOCK(gUsersLock); |
| ghash_walk_init(gUsers, &walk); | ghash_walk_init(gUsers, &walk); |
| while ((u = ghash_walk_next(gUsers, &walk)) != NULL) { | while ((u = ghash_walk_next(gUsers, &walk)) != NULL) { |
| Printf("\tUsername: %-15s Priv: %s\r\n", u->username, | Printf("\tUsername: %-15s Priv: %s\r\n", u->username, |
| ((u->priv == 2)?"admin":((u->priv == 1)?"operator":"user"))); | ((u->priv == 2)?"admin":((u->priv == 1)?"operator":"user"))); |
| } | } |
| RWLOCK_UNLOCK(gUsersLock); | pthread_cleanup_pop(1); |
| return 0; | return 0; |
| } | } |