]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
script: enable if_ssid again
authorRoy Marples <roy@marples.name>
Wed, 19 Jun 2019 20:33:57 +0000 (21:33 +0100)
committerRoy Marples <roy@marples.name>
Wed, 19 Jun 2019 20:33:57 +0000 (21:33 +0100)
src/script.c

index 8297eda6860675ed84d37515be6aeb8f066def55..2874b7ab6d1991de8ebd5ddee5d952ba7992a500 100644 (file)
@@ -378,25 +378,16 @@ make_env(const struct interface *ifp, const char *reason)
                if (efprintf(fp, "profile=%s", ifp->profile) == -1)
                        goto eexit;
        }
-#if 0
        if (ifp->wireless) {
-               static const char *pfx = "ifssid=";
-               size_t pfx_len;
-               ssize_t psl;
-
-               pfx_len = strlen(pfx);
-               psl = print_string(NULL, 0, OT_ESCSTRING,
-                   (const uint8_t *)ifp->ssid, ifp->ssid_len);
-               if (psl != -1) {
-                       EMALLOC(elen, pfx_len + (size_t)psl + 1);
-                       memcpy(env[elen], pfx, pfx_len);
-                       print_string(env[elen] + pfx_len, (size_t)psl + 1,
-                           OT_ESCSTRING,
-                           (const uint8_t *)ifp->ssid, ifp->ssid_len);
-                       elen++;
+               char pssid[IF_SSIDLEN * 4];
+
+               if (print_string(pssid, sizeof(pssid), OT_ESCSTRING,
+                   ifp->ssid, ifp->ssid_len) != -1)
+               {
+                       if (efprintf(fp, "ifssid=%s", pssid) == -1)
+                               goto eexit;
                }
        }
-#endif
 #ifdef INET
        if (protocol == PROTO_DHCP && state && state->old) {
                if (dhcp_env(fp, "old", ifp,