yes, patch not applicable to WCE.
WCE don't support environment variables, other projects try to emulate it:
https://bugzilla.mozilla.org/show_bug.cgi?id=465874 (through command line)
http://pocoproject.org/docs-1.5.1/99200-WinCEPlatformNotes.html#3
(hardcoded)
attached new version of patch with disabled feature on WCE platform.
2016-05-31 10:05 GMT+04:00 Michał Trojnara <[email protected]>:
> I'm pretty sure the use of ExpandEnvironmentStringsA() will break WCE
> builds. Please correct me if I'm wrong.
>
--- stunnel-5.32/src/options.c.orig 2016-05-03 22:35:03.000000000 +0400
+++ stunnel-5.32/src/options.c 2016-05-31 10:40:49.000000000 +0400
@@ -329,10 +329,63 @@
return 0;
}
+#ifndef USE_WIN32
+#ifndef _WIN32_WCE
+unsigned int ExpandEnvironmentStringsA(const char *lpSrc, char *lpDst, size_t nSize) {
+ const char *from;
+ char *to;
+ const char *begin;
+ const char *end;
+ char *name;
+ const char *value;
+ size_t len;
+
+ from = lpSrc;
+ to = lpDst;
+ while ((begin = strchr(from, '$'))) {
+ len = (size_t)(begin - from);
+ if (*(begin + 1) == '{' && (end = strchr(begin, '}')) ) {
+ if ((size_t)(to - lpDst) + len >= nSize) return 0;
+ strncpy(to, from, len);
+ to += len;
+ len = (size_t)(end - begin - 2);
+ name = strndup(begin + 2, len);
+ value = getenv(name);
+ free(name);
+ if (value) {
+ len = strlen(value);
+ if ((size_t)(to - lpDst) + len >= nSize) return 0;
+ strncpy(to, value, len);
+ } else {
+ len = (size_t)(end - begin + 1);
+ if ((size_t)(to - lpDst) + len >= nSize) return 0;
+ strncpy(to, begin, len);
+ }
+ } else {
+ len++; /* +$ itself */
+ if ((size_t)(to - lpDst) + len >= nSize) return 0;
+ strncpy(to, from, len);
+ end = from + len - 1;
+ }
+ to += len;
+ from = end + 1;
+ }
+ len = strlen(from); /* rest of string */
+ if ((size_t)(to - lpDst) + len >= nSize) return 0;
+ strncpy(to, from, len);
+ to[len] = '\0';
+ return strlen(lpDst);
+}
+#endif /* !defined(_WIN32_WCE) */
+#endif /* !defined(USE_WIN32) */
+
NOEXPORT int options_file(char *path, CONF_TYPE type, SERVICE_OPTIONS **section) {
DISK_FILE *df;
char line_text[CONFLINELEN], *errstr;
char config_line[CONFLINELEN], *config_opt, *config_arg;
+#ifndef _WIN32_WCE
+ char env_expanded[CONFLINELEN];
+#endif /* !defined(_WIN32_WCE) */
int i, line_number=0;
#ifndef USE_WIN32
int fd;
@@ -429,6 +482,18 @@
continue;
}
+#ifndef _WIN32_WCE
+ if(config_arg) {
+ if(ExpandEnvironmentStringsA(config_arg, env_expanded, sizeof(env_expanded))) {
+ config_arg=env_expanded;
+ } else {
+ s_log(LOG_ERR, "%s:%d: Failed to expand environment variables \"%s\"",
+ path, line_number, config_arg);
+ return 1;
+ }
+ }
+#endif /* !defined(_WIN32_WCE) */
+
errstr=option_not_found;
/* try global options first (e.g. for 'debug') */
if(!new_service_options.next)
_______________________________________________
stunnel-users mailing list
[email protected]
https://www.stunnel.org/cgi-bin/mailman/listinfo/stunnel-users