mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Modifications for updated Windows Build.
1) mods to use miniupnpc v1.3 2) bugfix to use WriteFile instead of write under windows with gpgme. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1449 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3394239297
commit
870a30eac5
@ -106,8 +106,15 @@ gpg_error_t pgp_pwd_callback(void *hook, const char *uid_hint, const char *passp
|
||||
//fprintf(stderr, "pgp_pwd_callback() Set Password to:\"%s\"\n", passwd);
|
||||
fprintf(stderr, "pgp_pwd_callback() Set Password\n");
|
||||
|
||||
#ifndef WINDOWS_SYS
|
||||
write(fd, passwd, strlen(passwd));
|
||||
write(fd, "\n", 1); /* needs a new line? */
|
||||
#else
|
||||
DWORD written = 0;
|
||||
HANDLE winFd = (HANDLE) fd;
|
||||
WriteFile(winFd, passwd, strlen(passwd), &written, NULL);
|
||||
WriteFile(winFd, "\n", 1, &written, NULL);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -140,7 +147,7 @@ GPGAuthMgr::GPGAuthMgr()
|
||||
gpgme_check_version(NULL);
|
||||
gpgme_set_locale(NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
|
||||
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
#ifdef LC_MESSAGES
|
||||
gpgme_set_locale(NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
|
||||
#endif
|
||||
|
||||
@ -2233,9 +2240,18 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
|
||||
if (result)
|
||||
{
|
||||
fprintf(stderr,"keySignCallback result:%s\n", result);
|
||||
#ifndef WINDOWS_SYS
|
||||
if (*result)
|
||||
write (fd, result, strlen (result));
|
||||
write (fd, "\n", 1);
|
||||
#else
|
||||
DWORD written = 0;
|
||||
HANDLE winFd = (HANDLE) fd;
|
||||
if (*result)
|
||||
WriteFile(winFd, result, strlen(result), &written, NULL);
|
||||
WriteFile(winFd, "\n", 1, &written, NULL);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
fprintf(stderr,"keySignCallback Error status\n");
|
||||
@ -2334,9 +2350,17 @@ static gpgme_error_t trustCallback(void *opaque, gpgme_status_code_t status, \
|
||||
|
||||
if (result)
|
||||
{
|
||||
#ifndef WINDOWS_SYS
|
||||
if (*result)
|
||||
write (fd, result, strlen (result));
|
||||
write (fd, "\n", 1);
|
||||
#else
|
||||
DWORD written = 0;
|
||||
HANDLE winFd = (HANDLE) fd;
|
||||
if (*result)
|
||||
WriteFile(winFd, result, strlen (result), &written, NULL);
|
||||
WriteFile(winFd, "\n", 1, &written, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
return params->err;
|
||||
|
@ -141,14 +141,20 @@ bool SetRedirectAndTest(struct UPNPUrls * urls,
|
||||
printf("GetExternalIPAddress failed.\n");
|
||||
|
||||
// Unix at the moment!
|
||||
#if MINIUPNPC_VERSION >= 12
|
||||
#if MINIUPNPC_VERSION >= 13
|
||||
/* Starting from miniupnpc version 1.2, lease duration parameter is gone */
|
||||
r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||
eport, iport, iaddr, 0, proto, NULL);
|
||||
#else
|
||||
#if MINIUPNPC_VERSION >= 12
|
||||
/* Starting from miniupnpc version 1.2, lease duration parameter is gone */
|
||||
r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||
eport, iport, iaddr, 0, proto);
|
||||
#else
|
||||
#else
|
||||
/* The lease parameter is also gone in minupnpc 1.0 */
|
||||
r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||
eport, iport, iaddr, 0, proto);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||
@ -271,7 +277,11 @@ RemoveRedirect(struct UPNPUrls * urls,
|
||||
fprintf(stderr, "protocol invalid\n");
|
||||
return 0;
|
||||
}
|
||||
#if MINIUPNPC_VERSION >= 13
|
||||
UPNP_DeletePortMapping(urls->controlURL, data->servicetype, eport, proto, NULL);
|
||||
#else
|
||||
UPNP_DeletePortMapping(urls->controlURL, data->servicetype, eport, proto);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user