mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 08:48:31 -05:00
WPS UFD: Define macros for the UFD directory templates
This allows the UNIX vs. DOS path separators to be handled in the build.
This commit is contained in:
parent
70e070461d
commit
e7f3c1f436
@ -22,6 +22,17 @@
|
|||||||
|
|
||||||
#include "wps/wps.h"
|
#include "wps/wps.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_NATIVE_WINDOWS
|
||||||
|
#define UFD_DIR1 "%s\\SMRTNTKY"
|
||||||
|
#define UFD_DIR2 UFD_DIR1 "\\WFAWSC"
|
||||||
|
#define UFD_FILE UFD_DIR2 "\\%s"
|
||||||
|
#else /* CONFIG_NATIVE_WINDOWS */
|
||||||
|
#define UFD_DIR1 "%s/SMRTNTKY"
|
||||||
|
#define UFD_DIR2 UFD_DIR1 "/WFAWSC"
|
||||||
|
#define UFD_FILE UFD_DIR2 "/%s"
|
||||||
|
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||||
|
|
||||||
|
|
||||||
struct wps_ufd_data {
|
struct wps_ufd_data {
|
||||||
int ufd_fd;
|
int ufd_fd;
|
||||||
};
|
};
|
||||||
@ -72,8 +83,7 @@ static int get_file_name(struct wps_context *wps, int registrar,
|
|||||||
case OOB_METHOD_DEV_PWD_E:
|
case OOB_METHOD_DEV_PWD_E:
|
||||||
if (registrar) {
|
if (registrar) {
|
||||||
char temp[128];
|
char temp[128];
|
||||||
|
os_snprintf(temp, sizeof(temp), UFD_DIR2,
|
||||||
os_snprintf(temp, sizeof(temp), "%s/SMRTNTKY/WFAWSC",
|
|
||||||
wps->oob_dev->device_path);
|
wps->oob_dev->device_path);
|
||||||
if (wps_get_dev_pwd_e_file_name(temp, file_name) < 0)
|
if (wps_get_dev_pwd_e_file_name(temp, file_name) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -128,16 +138,15 @@ static void * init_ufd(struct wps_context *wps, int registrar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (write_f) {
|
if (write_f) {
|
||||||
os_snprintf(temp, sizeof(temp), "%s/SMRTNTKY", path);
|
os_snprintf(temp, sizeof(temp), UFD_DIR1, path);
|
||||||
if (ufd_mkdir(temp))
|
if (ufd_mkdir(temp))
|
||||||
return NULL;
|
return NULL;
|
||||||
os_snprintf(temp, sizeof(temp), "%s/SMRTNTKY/WFAWSC", path);
|
os_snprintf(temp, sizeof(temp), UFD_DIR2, path);
|
||||||
if (ufd_mkdir(temp))
|
if (ufd_mkdir(temp))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
os_snprintf(temp, sizeof(temp), "%s/SMRTNTKY/WFAWSC/%s", path,
|
os_snprintf(temp, sizeof(temp), UFD_FILE, path, filename);
|
||||||
filename);
|
|
||||||
if (write_f)
|
if (write_f)
|
||||||
ufd_fd = open(temp, O_WRONLY | O_CREAT | O_TRUNC,
|
ufd_fd = open(temp, O_WRONLY | O_CREAT | O_TRUNC,
|
||||||
S_IRUSR | S_IWUSR);
|
S_IRUSR | S_IWUSR);
|
||||||
|
Loading…
Reference in New Issue
Block a user