Hello again, it worries me very much that as soon as the configuration involves a setting
## etc/shishi/shishi.conf # server-realm=EX.XRG,.ex.org where the realm EX.XRG is unknown to shisa(8), then calls to shishi(1) will throw segmentation faults. I expect shishi_done() to release whatever space was allocated, without any hindsight of misspelled names or realms. The above snippet would cause a crash if shisa(8) only knows about EX.ORG. (Notice the difference in a single letter.) Nominally the following patch fills the expected wildcard structures, but I have not set out to test it with actual accessing, only in running "shishi -l" with a larger number of shishi_warn() inserted to observe the effects of interrelated data structures. Use the difference text as an inspiration to complete the unfinished task! The mentioned segfault is urgent, though. I have no clear understanding of where it appears, except that it is an munmap_chunk() called from shishi_done(). Best regards, Mats E A diff --git a/lib/cfg.c b/lib/cfg.c index a0e39b3..db47435 100644 --- a/lib/cfg.c +++ b/lib/cfg.c @@ -118,7 +118,7 @@ shishi_cfg (Shishi * handle, const char *option) char *p = opt; char *value; char *realm = NULL; - int res; + int res, server_realm = 0; size_t i; while (p != NULL && *p != '\0') @@ -214,11 +214,10 @@ shishi_cfg (Shishi * handle, const char *option) case SERVER_REALM_OPTION: { struct Shishi_realminfo *ri; + + server_realm = 1; + realm = xstrdup (value); ri = _shishi_realminfo_new (handle, value); - ri->serverwildcards = xrealloc (ri->serverwildcards, - ++ri->nserverwildcards * - sizeof (*ri->serverwildcards)); - ri->serverwildcards[ri->nserverwildcards - 1] = xstrdup (value); } break; @@ -282,6 +281,14 @@ shishi_cfg (Shishi * handle, const char *option) char *protstr; int transport = UDP; + if (server_realm) + { + ri->serverwildcards = xrealloc (ri->serverwildcards, + ++ri->nserverwildcards * + sizeof (*ri->serverwildcards)); + ri->serverwildcards[ri->nserverwildcards - 1] = xstrdup (value); + break; + } if ((protstr = strchr (value, '/'))) { *protstr = '\0'; _______________________________________________ Help-shishi mailing list Help-shishi@gnu.org https://lists.gnu.org/mailman/listinfo/help-shishi