Procházet zdrojové kódy

Limit number of characters in ESSID and password

Bob Mottram před 10 roky
rodič
revize
19be45ced7
1 změnil soubory, kde provedl 11 přidání a 3 odebrání
  1. 11
    3
      install-freedombone.sh

+ 11
- 3
install-freedombone.sh Zobrazit soubor

@@ -7155,11 +7155,13 @@ function enable_wifi_hotspot {
7155 7155
 
7156 7156
   # Create an ESSID if one doesn't exist
7157 7157
   if [ ! $WIFI_ESSID ]; then
7158
-      WIFI_ESSID="Freedom"$(openssl rand -base64 4)
7158
+      TEMP_WIFI_ESSID="Freedom"$(openssl rand -base64 8)
7159
+      WIFI_ESSID=${$TEMP_WIFI_ESSID:0:3}
7159 7160
   fi
7160 7161
   # Add a password
7161 7162
   if [ ! $WIFI_PASSWORD ]; then
7162
-      WIFI_PASSWORD=$(openssl rand -base64 8)
7163
+      TEMP_WIFI_PASSWORD=$(openssl rand -base64 8)
7164
+      WIFI_PASSWORD=$($TEMP_WIFI_PASSWORD:0:8}
7163 7165
   fi
7164 7166
 
7165 7167
   sed -i 's|#DAEMON_CONF=.*|DAEMON_CONF="/etc/hostapd/hostapd.conf"|g' /etc/default/hostapd
@@ -7261,9 +7263,15 @@ function enable_wifi {
7261 7263
 
7262 7264
   # Create an ESSID if one doesn't exist
7263 7265
   if [ ! $WIFI_ESSID ]; then
7264
-      WIFI_ESSID="Freedom"$(openssl rand -base64 4)
7266
+      TEMP_WIFI_ESSID="Freedom"$(openssl rand -base64 8)
7267
+      WIFI_ESSID=${$TEMP_WIFI_ESSID:0:3}
7265 7268
   fi
7266 7269
   sed -i "s/essid/$WIFI_ESSID/g" /etc/network/interfaces
7270
+  # Add a password
7271
+  if [ ! $WIFI_PASSWORD ]; then
7272
+      TEMP_WIFI_PASSWORD=$(openssl rand -base64 8)
7273
+      WIFI_PASSWORD=$($TEMP_WIFI_PASSWORD:0:8}
7274
+  fi
7267 7275
 
7268 7276
   # Add a password
7269 7277
   if [ $WIFI_PASSWORD ]; then