Skip to content

Commit

Permalink
When hostname is fixed, don't allow changes in the web UI (Issue #369)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Oct 16, 2024
1 parent ada02f9 commit c8b22b4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pappl/system-webif.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,7 @@ _papplSystemWebNetwork(
{
const char *status = NULL; // Status message, if any
pappl_loc_t *loc; // Localization
char hostname[256]; // Hostname
size_t i, // Looping var
num_networks; // Number of network interfaces
pappl_network_t networks[_PAPPL_MAX_NETWORKS],
Expand Down Expand Up @@ -1193,7 +1194,13 @@ _papplSystemWebNetwork(
}
}

papplClientHTMLPrintf(client, " <tr><th><label for=\"hostname\">%s:</label></th><td><input type=\"text\" name=\"hostname\" value=\"%s\" placeholder=\"name.domain\" pattern=\"^(|[-_a-zA-Z0-9][-._a-zA-Z0-9]*)$\"> <input type=\"submit\" value=\"%s\"></td></tr>\n", papplClientGetLocString(client, _PAPPL_LOC("Hostname")), system->hostname, papplClientGetLocString(client, _PAPPL_LOC("Change Hostname")));
papplSystemGetHostName(system, hostname, sizeof(hostname));

papplClientHTMLPrintf(client, " <tr><th><label for=\"hostname\">%s:</label></th><td>", papplClientGetLocString(client, _PAPPL_LOC("Hostname")));
if (system->is_listenhost)
papplClientHTMLPrintf(client, "<input type=\"hidden\" name=\"hostname\" value=\"%s\">%s</td></tr>\n", hostname, hostname);
else
papplClientHTMLPrintf(client, "<input type=\"text\" name=\"hostname\" value=\"%s\" placeholder=\"name.domain\" pattern=\"^(|[-_a-zA-Z0-9][-._a-zA-Z0-9]*)$\"> <input type=\"submit\" value=\"%s\"></td></tr>\n", hostname, papplClientGetLocString(client, _PAPPL_LOC("Change Hostname")));

loc = papplClientGetLoc(client);

Expand Down

0 comments on commit c8b22b4

Please sign in to comment.