From c6b106f8f460c741160ff705c688595bfb1fc5ab Mon Sep 17 00:00:00 2001 From: tmraz Date: Jun 20 2005 13:59:40 +0000 Subject: - set domain and ypserver option correctly when multiple servers specified in kickstart (#159214) --- diff --git a/authconfig.spec.in b/authconfig.spec.in index 412620a..1233ec1 100644 --- a/authconfig.spec.in +++ b/authconfig.spec.in @@ -81,6 +81,10 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/pixmaps/* %changelog +* Mon Jun 20 2005 Tomas Mraz - 4.6.13-1 +- set domain and ypserver option correctly when multiple servers + specified in kickstart (#159214) + * Tue Apr 12 2005 Tomas Mraz - 4.6.12-1 - replaced deprecated gtk.TRUE/FALSE (#153034) - updated translations diff --git a/authinfo.c b/authinfo.c index ca1ca9e..ef33f45 100644 --- a/authinfo.c +++ b/authinfo.c @@ -1610,6 +1610,14 @@ authInfoWriteNIS(struct authInfoType *info) l = strlen(" domain ") + strlen(" broadcast "); l += info->nisDomain ? strlen(info->nisDomain) : 0; l += info->nisServer ? strlen(info->nisServer) : 0; + /* we need space for all the NIS servers */ + if (non_empty(info->nisServer)) { + p = info->nisServer; + while ((p=strchr(p, ',')) != NULL) { + l += strlen("ypserver ") + 1; + p++; + } + } obuf = g_malloc0(st.st_size + 1 + l); p = ibuf; @@ -1689,22 +1697,39 @@ authInfoWriteNIS(struct authInfoType *info) /* If we haven't encountered a domain line yet... */ if (!written) { + p = info->nisServer; if (non_empty(info->nisDomain)) { strcat(obuf, "domain "); strcat(obuf, info->nisDomain); - if (non_empty(info->nisServer)) { + if (non_empty(p)) { strcat(obuf, " server "); - strcat(obuf, info->nisServer); + if (strchr(p, ',')) { + char *q; + q = strchr(p, ','); + strncat(obuf, p, q - p); + p = q + 1; + } else { + strcat(obuf, p); + p = NULL; + } } else { strcat(obuf, " broadcast"); } strcat(obuf, "\n"); - } else { - if (non_empty(info->nisServer)) { + } + + if (non_empty(p)) { + while (strchr(p, ',')) { + char *q; + q = strchr(p, ','); strcat(obuf, "ypserver "); - strcat(obuf, info->nisServer); + strncat(obuf, p, q - p); strcat(obuf, "\n"); + p = q + 1; } + strcat(obuf, "ypserver "); + strcat(obuf, p); + strcat(obuf, "\n"); } } diff --git a/configure.in b/configure.in index 5ad6414..356ab1f 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -AC_INIT(authconfig,4.6.12) +AC_INIT(authconfig,4.6.13) AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip]) AC_PREFIX_DEFAULT(/usr) AC_PROG_CC