|
Lines 175-180
ConsoleClose(Console c)
Link Here
|
| 175 |
return 0; |
175 |
return 0; |
| 176 |
} |
176 |
} |
| 177 |
|
177 |
|
|
|
178 |
void |
| 179 |
ConsoleCancelCleanup(void *rwlock) |
| 180 |
{ |
| 181 |
pthread_rwlock_t p = (pthread_rwlock_t)rwlock; |
| 182 |
|
| 183 |
RWLOCK_UNLOCK(p); |
| 184 |
} |
| 185 |
|
| 178 |
/* |
186 |
/* |
| 179 |
* ConsoleStat() |
187 |
* ConsoleStat() |
| 180 |
*/ |
188 |
*/ |
|
Lines 192-204
ConsoleStat(Context ctx, int ac, char *a
Link Here
|
| 192 |
Printf("\tIP-Address : %s\r\n", u_addrtoa(&c->addr,addrstr,sizeof(addrstr))); |
200 |
Printf("\tIP-Address : %s\r\n", u_addrtoa(&c->addr,addrstr,sizeof(addrstr))); |
| 193 |
Printf("\tPort : %d\r\n", c->port); |
201 |
Printf("\tPort : %d\r\n", c->port); |
| 194 |
|
202 |
|
|
|
203 |
pthread_cleanup_push(ConsoleCancelCleanup, c->lock); |
| 195 |
RWLOCK_RDLOCK(c->lock); |
204 |
RWLOCK_RDLOCK(c->lock); |
| 196 |
Printf("Active sessions:\r\n"); |
205 |
Printf("Active sessions:\r\n"); |
| 197 |
SLIST_FOREACH(s, &c->sessions, next) { |
206 |
SLIST_FOREACH(s, &c->sessions, next) { |
| 198 |
Printf("\tUsername: %s\tFrom: %s\r\n", |
207 |
Printf("\tUsername: %s\tFrom: %s\r\n", |
| 199 |
s->user.username, u_addrtoa(&s->peer_addr,addrstr,sizeof(addrstr))); |
208 |
s->user.username, u_addrtoa(&s->peer_addr,addrstr,sizeof(addrstr))); |
| 200 |
} |
209 |
} |
| 201 |
RWLOCK_UNLOCK(c->lock); |
210 |
pthread_cleanup_pop(1); |
| 202 |
|
211 |
|
| 203 |
Printf("Global options:\r\n"); |
212 |
Printf("Global options:\r\n"); |
| 204 |
OptStat(ctx, &c->options, gConfList); |
213 |
OptStat(ctx, &c->options, gConfList); |
|
Lines 905-917
UserStat(Context ctx, int ac, char *av[]
Link Here
|
| 905 |
ConsoleUser u; |
914 |
ConsoleUser u; |
| 906 |
|
915 |
|
| 907 |
Printf("Configured users:\r\n"); |
916 |
Printf("Configured users:\r\n"); |
|
|
917 |
pthread_cleanup_push(ConsoleCancelCleanup, gUsersLock); |
| 908 |
RWLOCK_RDLOCK(gUsersLock); |
918 |
RWLOCK_RDLOCK(gUsersLock); |
| 909 |
ghash_walk_init(gUsers, &walk); |
919 |
ghash_walk_init(gUsers, &walk); |
| 910 |
while ((u = ghash_walk_next(gUsers, &walk)) != NULL) { |
920 |
while ((u = ghash_walk_next(gUsers, &walk)) != NULL) { |
| 911 |
Printf("\tUsername: %-15s Priv: %s\r\n", u->username, |
921 |
Printf("\tUsername: %-15s Priv: %s\r\n", u->username, |
| 912 |
((u->priv == 2)?"admin":((u->priv == 1)?"operator":"user"))); |
922 |
((u->priv == 2)?"admin":((u->priv == 1)?"operator":"user"))); |
| 913 |
} |
923 |
} |
| 914 |
RWLOCK_UNLOCK(gUsersLock); |
924 |
pthread_cleanup_pop(1); |
| 915 |
|
925 |
|
| 916 |
return 0; |
926 |
return 0; |
| 917 |
} |
927 |
} |