-
Notifications
You must be signed in to change notification settings - Fork 7
rebase #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: RDKOSS-615
Are you sure you want to change the base?
rebase #351
Changes from all commits
86f97c4
422ef6a
d47094b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,82 @@ | ||||||||||||||||||
| Index: wpa_supplicant-2.10/wpa_supplicant/bgscan_simple.c | ||||||||||||||||||
| =================================================================== | ||||||||||||||||||
| --- wpa_supplicant-2.10.orig/wpa_supplicant/bgscan_simple.c | ||||||||||||||||||
| +++ wpa_supplicant-2.10/wpa_supplicant/bgscan_simple.c | ||||||||||||||||||
| @@ -27,6 +27,7 @@ struct bgscan_simple_data { | ||||||||||||||||||
| int short_interval; /* use if signal < threshold */ | ||||||||||||||||||
| int long_interval; /* use if signal > threshold */ | ||||||||||||||||||
| struct os_reltime last_bgscan; | ||||||||||||||||||
| + int roaming_threshold_db; /* min RSSI gain (dB) required to allow roam */ | ||||||||||||||||||
| }; | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| @@ -95,6 +96,11 @@ static int bgscan_simple_get_params(stru | ||||||||||||||||||
| } | ||||||||||||||||||
| pos++; | ||||||||||||||||||
| data->long_interval = atoi(pos); | ||||||||||||||||||
| + pos = os_strchr(pos, ':'); | ||||||||||||||||||
| + if (pos == NULL) | ||||||||||||||||||
| + return 0; | ||||||||||||||||||
| + pos++; | ||||||||||||||||||
| + data->roaming_threshold_db = atoi(pos); | ||||||||||||||||||
|
|
||||||||||||||||||
| return 0; | ||||||||||||||||||
| } | ||||||||||||||||||
| @@ -119,11 +125,16 @@ static void * bgscan_simple_init(struct | ||||||||||||||||||
| data->short_interval = 30; | ||||||||||||||||||
| if (data->long_interval <= 0) | ||||||||||||||||||
| data->long_interval = 30; | ||||||||||||||||||
| + if (data->roaming_threshold_db < 0) | ||||||||||||||||||
| + data->roaming_threshold_db = 0; | ||||||||||||||||||
| + | ||||||||||||||||||
| + wpa_s->roaming_threshold_db = data->roaming_threshold_db; | ||||||||||||||||||
|
|
||||||||||||||||||
| wpa_printf(MSG_DEBUG, "bgscan simple: Signal strength threshold %d " | ||||||||||||||||||
| - "Short bgscan interval %d Long bgscan interval %d", | ||||||||||||||||||
| + "Short bgscan interval %d Long bgscan interval %d " | ||||||||||||||||||
| + "Roaming threshold %d", | ||||||||||||||||||
| data->signal_threshold, data->short_interval, | ||||||||||||||||||
| - data->long_interval); | ||||||||||||||||||
| + data->long_interval, data->roaming_threshold_db); | ||||||||||||||||||
|
|
||||||||||||||||||
| if (data->signal_threshold && | ||||||||||||||||||
| wpa_drv_signal_monitor(wpa_s, data->signal_threshold, 4) < 0) { | ||||||||||||||||||
| Index: wpa_supplicant-2.10/wpa_supplicant/events.c | ||||||||||||||||||
| =================================================================== | ||||||||||||||||||
| --- wpa_supplicant-2.10.orig/wpa_supplicant/events.c | ||||||||||||||||||
| +++ wpa_supplicant-2.10/wpa_supplicant/events.c | ||||||||||||||||||
| @@ -1927,6 +1927,22 @@ int wpa_supplicant_need_to_roam_within_e | ||||||||||||||||||
| cur_level, cur_snr, cur_est); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| + /* Enforce RSSI delta >= roaming_threshold_db before allowing reassociation */ | ||||||||||||||||||
| + if (wpa_s->roaming_threshold_db > 0) { | ||||||||||||||||||
| + int delta_db = selected->level - cur_level; /* dBm; delta>0 => candidate stronger */ | ||||||||||||||||||
| + if (delta_db < wpa_s->roaming_threshold_db) { | ||||||||||||||||||
| + wpa_dbg(wpa_s, MSG_DEBUG, | ||||||||||||||||||
| + "Skip roam - RSSI delta=%d dB < threshold=%d dB", | ||||||||||||||||||
| + delta_db, wpa_s->roaming_threshold_db); | ||||||||||||||||||
| + /* Prevent the reassociation for this scan */ | ||||||||||||||||||
| + return 0; | ||||||||||||||||||
| + /* Option A: clear candidate … */ | ||||||||||||||||||
| +// selected = NULL; | ||||||||||||||||||
| + /* Option B: or ensure the local 'allow_reassoc' variable stays false */ | ||||||||||||||||||
| + /* allow_reassoc = 0; */ | ||||||||||||||||||
|
Comment on lines
+59
to
+64
|
||||||||||||||||||
| + /* Prevent the reassociation for this scan */ | |
| + return 0; | |
| + /* Option A: clear candidate … */ | |
| +// selected = NULL; | |
| + /* Option B: or ensure the local 'allow_reassoc' variable stays false */ | |
| + /* allow_reassoc = 0; */ | |
| + /* Prevent reassociation for this scan if RSSI gain is too small */ | |
| + return 0; |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||||||
| SUMMARY = "Library for using PKCS" | ||||||||||
| DESCRIPTION = "\ | ||||||||||
| Libp11 is a library implementing a small layer on top of PKCS \ | ||||||||||
| make using PKCS" | ||||||||||
|
Comment on lines
+3
to
+4
|
||||||||||
| Libp11 is a library implementing a small layer on top of PKCS \ | |
| make using PKCS" | |
| Libp11 is a library implementing a small layer on top of PKCS#11 to make using PKCS#11 easier for applications.\ | |
| " |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,121 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| From 91880074f52d9392dac8d658a9b48dca3f824ea0 Mon Sep 17 00:00:00 2001 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| From: ldonth501 <LasyaPrakarsha_DonthiVenkata@comcast.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Date: Sat, 5 Oct 2024 15:32:26 +0000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Subject: [PATCH] stunnel: Non-interactive passcode for p12 cert | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Upstream-Status: Pending | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Recognize .pk12 extension as p12 cert. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Attempt to obtain the passcode for p12 cert from fd environment variable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Signed-off-by: ldonth501 <LasyaPrakarsha_DonthiVenkata@comcast.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| src/ctx.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1 file changed, 66 insertions(+), 2 deletions(-) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Index: stunnel-5.65/src/ctx.c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| =================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --- stunnel-5.65.orig/src/ctx.c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| +++ stunnel-5.65/src/ctx.c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @@ -767,12 +767,14 @@ PSK_KEYS *psk_find(const PSK_TABLE *tabl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NOEXPORT int pkcs12_extension(const char *filename) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const char *ext=strrchr(filename, '.'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - return ext && (!strcasecmp(ext, ".p12") || !strcasecmp(ext, ".pfx")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + return ext && (!strcasecmp(ext, ".p12") || !strcasecmp(ext, ".pfx") || !strcasecmp(ext, ".pk12")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| +#define FD_READ_TIMEOUT_SECONDS 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NOEXPORT int load_pkcs12_file(SERVICE_OPTIONS *section) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size_t len; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - int i, success; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + int i, success = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BIO *bio=NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PKCS12 *p12=NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| X509 *cert=NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @@ -798,6 +800,74 @@ NOEXPORT int load_pkcs12_file(SERVICE_OP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BIO_free(bio); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + const char *fd_str = getenv("FD_NUMBER"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + const char *fd_str = getenv("FD_NUMBER"); | |
| + const char *fd_str = secure_getenv("FD_NUMBER"); |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buffer size of 64 bytes for the passcode is arbitrary and may be insufficient for some use cases or excessive for others. Consider defining this as a named constant (e.g., MAX_P12_PASSCODE_LEN) to improve maintainability and make it easier to adjust if needed.
| + char p12_passcode[64] = {0}; | |
| +#ifndef MAX_P12_PASSCODE_LEN | |
| +#define MAX_P12_PASSCODE_LEN 64 | |
| +#endif | |
| + | |
| + char p12_passcode[MAX_P12_PASSCODE_LEN] = {0}; |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When bytes_read equals 0 (EOF), only an info log is generated and execution continues. However, p12_passcode will be empty (all zeros from initialization), which will cause the PKCS12_parse on line 97 to fail with an empty password. This path should jump to interactive_start since no password was read, similar to the error case.
| + s_log(LOG_INFO, "EOF encountered, no more data to read."); | |
| + } else { | |
| + s_log(LOG_ERR, "read error: %s", strerror(errno)); | |
| + s_log(LOG_INFO, "EOF encountered, no more data to read."); | |
| + close(fd); | |
| + goto interactive_start; | |
| + } else { | |
| + s_log(LOG_ERR, "read error: %s", strerror(errno)); | |
| + close(fd); |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file descriptor is closed unconditionally on line 93, even when read fails or returns 0 bytes. However, if the select call times out or fails (lines 73-77), execution jumps to interactive_start before reaching the close call, which will leave the file descriptor open and cause a resource leak. The close call should be moved before the goto interactive_start statements or handled in all error paths.
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The read call on line 80 could potentially read partial data if the full passcode hasn't been written to the file descriptor yet. While select indicates readiness, it doesn't guarantee that all expected data is available. Consider implementing a loop to read until a newline is encountered or the buffer is full, or document the assumption that the entire passcode will be written atomically.
| + ssize_t bytes_read = read(fd, p12_passcode, sizeof(p12_passcode) - 1); | |
| + if (bytes_read > 0) { | |
| + if (p12_passcode[bytes_read - 1] == '\n') { | |
| + p12_passcode[bytes_read - 1] = '\0'; | |
| + } else { | |
| + p12_passcode[bytes_read] = '\0'; | |
| + } | |
| + } else if (bytes_read == 0) { | |
| + s_log(LOG_INFO, "EOF encountered, no more data to read."); | |
| + } else { | |
| + s_log(LOG_ERR, "read error: %s", strerror(errno)); | |
| + goto interactive_start; | |
| + } | |
| + ssize_t total_read = 0; | |
| + ssize_t bytes_read; | |
| + int done = 0; | |
| + | |
| + /* Read until newline, buffer full, EOF, or error */ | |
| + while (total_read < (ssize_t)sizeof(p12_passcode) - 1 && !done) { | |
| + bytes_read = read(fd, p12_passcode + total_read, | |
| + sizeof(p12_passcode) - 1 - total_read); | |
| + if (bytes_read > 0) { | |
| + ssize_t i; | |
| + for (i = total_read; i < total_read + bytes_read; ++i) { | |
| + if (p12_passcode[i] == '\n') { | |
| + p12_passcode[i] = '\0'; | |
| + done = 1; | |
| + break; | |
| + } | |
| + } | |
| + total_read += bytes_read; | |
| + } else if (bytes_read == 0) { | |
| + s_log(LOG_INFO, "EOF encountered, no more data to read."); | |
| + break; | |
| + } else { | |
| + if (errno == EINTR) { | |
| + continue; | |
| + } | |
| + s_log(LOG_ERR, "read error: %s", strerror(errno)); | |
| + goto interactive_start; | |
| + } | |
| + } | |
| + | |
| + if (!done) { | |
| + /* Ensure null termination if no newline encountered */ | |
| + p12_passcode[total_read] = '\0'; | |
| + } | |
| + |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging passwords or password-related errors at LOG_ERR level on line 108 after all non-interactive methods fail could leak sensitive information in system logs. Consider using a more generic error message that doesn't reveal password-related details, or ensure that the interactive fallback is logged at a less severe level like LOG_INFO or LOG_DEBUG.
| + s_log(LOG_ERR, "Unable to obtain passcode non-interactively"); | |
| + s_log(LOG_INFO, "Unable to obtain passcode non-interactively"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation logic checks if roaming_threshold_db is less than 0 and sets it to 0 if so, but the patch description and variable name suggest this should be a positive threshold value in dB. A threshold of 0 dB means no RSSI improvement is required for roaming, which may not be the intended behavior. Consider whether negative values should be rejected entirely, or if the default should be a positive value that represents a meaningful RSSI delta requirement.