: CSecurity(cc), session(NULL), anon_cred(NULL), cert_cred(NULL),
anon(_anon), tlsis(NULL), tlsos(NULL), rawis(NULL), rawos(NULL)
{
- cafile = X509CA.getData();
- crlfile = X509CRL.getData();
-
if (gnutls_global_init() != GNUTLS_E_SUCCESS)
throw AuthFailureException("gnutls_global_init failed");
}
{
shutdown();
- delete[] cafile;
- delete[] crlfile;
-
gnutls_global_deinit();
}
if (gnutls_certificate_set_x509_system_trust(cert_cred) < 1)
vlog.error("Could not load system certificate trust store");
- if (*cafile && gnutls_certificate_set_x509_trust_file(cert_cred,cafile,GNUTLS_X509_FMT_PEM) < 0)
+ if (gnutls_certificate_set_x509_trust_file(cert_cred, X509CA, GNUTLS_X509_FMT_PEM) < 0)
vlog.error("Could not load user specified certificate authority");
- if (*crlfile && gnutls_certificate_set_x509_crl_file(cert_cred,crlfile,GNUTLS_X509_FMT_PEM) < 0)
+ if (gnutls_certificate_set_x509_crl_file(cert_cred, X509CRL, GNUTLS_X509_FMT_PEM) < 0)
vlog.error("Could not load user specified certificate revocation list");
if (gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, cert_cred) != GNUTLS_E_SUCCESS)
gnutls_certificate_credentials_t cert_cred;
bool anon;
- char *cafile, *crlfile;
-
rdr::InStream* tlsis;
rdr::OutStream* tlsos;
#include <rfb/InputHandler.h>
#include <rfb/Exception.h>
#include <rfb/screenTypes.h>
-#include <rfb/util.h>
namespace network { class Socket; }
#define __RFB_SSECURITY_H__
#include <rfb/SConnection.h>
-#include <rfb/util.h>
+
#include <list>
namespace rfb {
void SSecurityRSAAES::loadPrivateKey()
{
- FILE* file = fopen(keyFile.getData(), "rb");
+ FILE* file = fopen(keyFile, "rb");
if (!file)
throw ConnFailedException("failed to open key file");
fseek(file, 0, SEEK_END);
dh_params = NULL;
#endif
- certfile = X509_CertFile.getData();
- keyfile = X509_KeyFile.getData();
-
if (gnutls_global_init() != GNUTLS_E_SUCCESS)
throw AuthFailureException("gnutls_global_init failed");
}
{
shutdown();
- delete[] keyfile;
- delete[] certfile;
-
gnutls_global_deinit();
}
gnutls_certificate_set_dh_params(cert_cred, dh_params);
#endif
- switch (gnutls_certificate_set_x509_key_file(cert_cred, certfile, keyfile, GNUTLS_X509_FMT_PEM)) {
+ switch (gnutls_certificate_set_x509_key_file(cert_cred, X509_CertFile, X509_KeyFile, GNUTLS_X509_FMT_PEM)) {
case GNUTLS_E_SUCCESS:
break;
case GNUTLS_E_CERTIFICATE_KEY_MISMATCH:
#endif
gnutls_anon_server_credentials_t anon_cred;
gnutls_certificate_credentials_t cert_cred;
- char *keyfile, *certfile;
bool anon;
#include <rfb/Password.h>
#include <rfb/Configuration.h>
#include <rfb/LogWriter.h>
-#include <rfb/util.h>
#include <rfb/Exception.h>
#include <string.h>
#include <stdio.h>
if (obfuscated.length == 0) {
if (passwdFile) {
- CharArray fname(passwdFile->getData());
- if (!fname.buf[0]) {
+ const char *fname = *passwdFile;
+ if (!fname[0]) {
vlog.info("neither %s nor %s params set", getName(), passwdFile->getName());
return;
}
- FILE* fp = fopen(fname.buf, "r");
+ FILE* fp = fopen(fname, "r");
if (!fp) {
- vlog.error("opening password file '%s' failed",fname.buf);
+ vlog.error("opening password file '%s' failed", fname);
return;
}
Security::Security(StringParameter &secTypes)
{
- char *secTypesStr;
-
- secTypesStr = secTypes.getData();
- enabledSecTypes = parseSecTypes(secTypesStr);
-
- delete [] secTypesStr;
+ enabledSecTypes = parseSecTypes(secTypes);
}
const std::list<uint8_t> Security::GetEnabledSecTypes(void)
const char *username,
const char *password)
{
- CharArray service(strDup(pamService.getData()));
- return do_pam_auth(service.buf, username, password);
+ return do_pam_auth(pamService, username, password);
}
break;
}
- CharArray displaynameStr(displayname.getData());
- if (!(dpy = XOpenDisplay(displaynameStr.buf))) {
+ if (!(dpy = XOpenDisplay(displayname))) {
fprintf(stderr,"%s: unable to open display \"%s\"\n",
- programName, XDisplayName(displaynameStr.buf));
+ programName, XDisplayName(displayname));
exit(1);
}
if (!XVncExtQueryExtension(dpy, &vncExtEventBase, &vncExtErrorBase)) {
fprintf(stderr,"No VNC extension on display %s\n",
- XDisplayName(displaynameStr.buf));
+ XDisplayName(displayname));
exit(1);
}
m_rect.setXYWH(0, 0, fullWidth, fullHeight);
// Parse geometry specification and save the result in m_rect.
- const char *param = m_geometryParam.getData();
+ const char *param = m_geometryParam;
bool geometrySpecified = (strlen(param) > 0);
if (geometrySpecified) {
m_rect = parseString(param);
}
- delete[] param; // don't forget to deallocate memory
- // allocated by StringParameter::getData()
if (m_rect.is_empty()) {
vlog.info("Desktop geometry is invalid");
return; // further processing does not make sense
usage();
}
- CharArray dpyStr(displayname.getData());
- if (!(dpy = XOpenDisplay(dpyStr.buf[0] ? dpyStr.buf : 0))) {
+ if (!(dpy = XOpenDisplay(displayname))) {
// FIXME: Why not vlog.error(...)?
fprintf(stderr,"%s: unable to open display \"%s\"\r\n",
- programName, XDisplayName(dpyStr.buf));
+ programName, XDisplayName(displayname));
exit(1);
}
(int)rfbport);
}
- const char *hostsData = hostsFile.getData();
- FileTcpFilter fileTcpFilter(hostsData);
- if (strlen(hostsData) != 0)
+ FileTcpFilter fileTcpFilter(hostsFile);
+ if (strlen(hostsFile) != 0)
for (std::list<SocketListener*>::iterator i = listeners.begin();
i != listeners.end();
i++)
(*i)->setFilter(&fileTcpFilter);
- delete[] hostsData;
PollingScheduler sched((int)pollingCycle, (int)maxProcessorUsage);
#include <rfb/Configuration.h>
#include <rfb/Logger_stdio.h>
#include <rfb/LogWriter.h>
-#include <rfb/util.h>
#include <rfb/ServerCore.h>
#include <rdr/HexOutStream.h>
#include <rfb/LogWriter.h>
port);
}
- CharArray desktopNameStr(desktopName.getData());
PixelFormat pf = vncGetPixelFormat(scr);
vncSetGlueContext(scr);
desktop[scr] = new XserverDesktop(scr,
listeners,
- desktopNameStr.buf,
+ desktopName,
pf,
vncGetScreenWidth(),
vncGetScreenHeight(),
void UserDialog::getUserPasswd(bool secure, char** user, char** password)
{
- CharArray passwordFileStr(passwordFile.getData());
+ const char *passwordFileName(passwordFile);
assert(password);
char *envUsername = getenv("VNC_USERNAME");
return;
}
- if (!user && passwordFileStr.buf[0]) {
+ if (!user && passwordFileName[0]) {
ObfuscatedPasswd obfPwd(256);
FILE* fp;
- fp = fopen(passwordFileStr.buf, "rb");
+ fp = fopen(passwordFileName, "rb");
if (!fp)
throw rfb::Exception(_("Opening password file failed"));
#ifndef WIN32
/* Specifying -via and -listen together is nonsense */
- if (listenMode && strlen(via.getValueStr()) > 0) {
+ if (listenMode && strlen(via) > 0) {
// TRANSLATORS: "Parameters" are command line arguments, or settings
// from a file or the Windows registry.
vlog.error(_("Parameters -listen and -via are incompatible"));
}
#ifndef WIN32
- if (strlen (via.getValueStr()) > 0 && mktunnel() != 0)
+ if (strlen(via) > 0 && mktunnel() != 0)
usage(argv[0]);
#endif
}
// If we successfully start()ed then perform the DisconnectAction
if (core) {
CurrentUserToken cut;
- CharArray action(disconnectAction.getData());
- if (stricmp(action.buf, "Logoff") == 0) {
+ if (stricmp(disconnectAction, "Logoff") == 0) {
if (!cut.h)
vlog.info("ignoring DisconnectAction=Logoff - no current user");
else
ExitWindowsEx(EWX_LOGOFF, 0);
- } else if (stricmp(action.buf, "Lock") == 0) {
+ } else if (stricmp(disconnectAction, "Lock") == 0) {
if (!cut.h) {
vlog.info("ignoring DisconnectAction=Lock - no current user");
} else {
// Opening the whole display with CreateDC doesn't work on multi-monitor
// systems for some reason.
DeviceContext* new_device = 0;
- CharArray deviceName(displayDevice.getData());
- if (deviceName.buf[0]) {
- vlog.info("Attaching to device %s", deviceName.buf);
- new_device = new DeviceDC(deviceName.buf);
+ if (strlen(displayDevice) > 0) {
+ vlog.info("Attaching to device %s", (const char*)displayDevice);
+ new_device = new DeviceDC(displayDevice);
}
if (!new_device) {
vlog.info("Attaching to virtual desktop");
// Get the coordinates of the specified dispay device
Rect newScreenRect;
- if (deviceName.buf[0]) {
- MonitorInfo info(deviceName.buf);
+ if (strlen(displayDevice) > 0) {
+ MonitorInfo info(displayDevice);
newScreenRect = Rect(info.rcMonitor.left, info.rcMonitor.top,
info.rcMonitor.right, info.rcMonitor.bottom);
} else {
bool isChanged() {
try {
CharArray new_hosts(getHosts());
- CharArray old_hosts(hosts.getData());
- return (strcmp(new_hosts.buf, old_hosts.buf) != 0) ||
+ return (strcmp(new_hosts.buf, hosts) != 0) ||
(localHost != isItemChecked(IDC_LOCALHOST)) ||
(port_number != getItemInt(IDC_PORT)) ||
(rfb::Server::idleTimeout != getItemInt(IDC_IDLE_TIMEOUT));
DesktopPage(const RegKey& rk)
: PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_DESKTOP)), regKey(rk) {}
void initDialog() {
- CharArray action(rfb::win32::SDisplay::disconnectAction.getData());
- bool disconnectLock = stricmp(action.buf, "Lock") == 0;
- bool disconnectLogoff = stricmp(action.buf, "Logoff") == 0;
+ const char *action(rfb::win32::SDisplay::disconnectAction);
+ bool disconnectLock = stricmp(action, "Lock") == 0;
+ bool disconnectLogoff = stricmp(action, "Logoff") == 0;
setItemChecked(IDC_DISCONNECT_LOGOFF, disconnectLogoff);
setItemChecked(IDC_DISCONNECT_LOCK, disconnectLock);
setItemChecked(IDC_DISCONNECT_NONE, !disconnectLock && !disconnectLogoff);
case IDC_DISCONNECT_NONE:
case IDC_REMOVE_WALLPAPER:
case IDC_DISABLE_EFFECTS:
- CharArray action(rfb::win32::SDisplay::disconnectAction.getData());
- bool disconnectLock = stricmp(action.buf, "Lock") == 0;
- bool disconnectLogoff = stricmp(action.buf, "Logoff") == 0;
+ const char *action(rfb::win32::SDisplay::disconnectAction);
+ bool disconnectLock = stricmp(action, "Lock") == 0;
+ bool disconnectLogoff = stricmp(action, "Logoff") == 0;
setChanged((disconnectLogoff != isItemChecked(IDC_DISCONNECT_LOGOFF)) ||
(disconnectLock != isItemChecked(IDC_DISCONNECT_LOCK)) ||
(isItemChecked(IDC_REMOVE_WALLPAPER) != rfb::win32::SDisplay::removeWallpaper) ||
rfbSock.setPort(port_number, localHost);
// -=- Update the TCP address filter for both ports, if open.
- CharArray pattern(hosts.getData());
- rfbSock.setFilter(pattern.buf);
+ rfbSock.setFilter(hosts);
// -=- Update the tray icon tooltip text with IP addresses
processAddressChange();