- if ((se = getservbyname(AMANDA_SERVICE_NAME, "udp")) == NULL)
- port = AMANDA_SERVICE_DEFAULT;
- else
- port = (in_port_t)ntohs(se->s_port);
+ if (conf_fn) {
+ service = conf_fn("client_port", datap);
+ if (!service || strlen(service) <= 1)
+ service = "amanda";
+ } else {
+ service = "amanda";
+ }
+ port = find_port_for_service(service, "udp");
+ if (port == 0) {
+ security_seterror(&bh->sech, _("%s/udp unknown protocol"), service);
+ (*fn)(arg, &bh->sech, S_ERROR);
+ amfree(canonname);
+ return;
+ }
+