Commit 22433a00 authored by Jondy Zhao's avatar Jondy Zhao

Fix netreport trial bugs

parent e37ab642
......@@ -141,11 +141,11 @@ class NetDriveUsageReporter(object):
def insertUsageReport(self, monitor, start, duration):
q = self._db.execute
for r in monitor.usageReport():
for r in eval(monitor.netdrive_usage()):
q( "INSERT INTO net_drive_usage "
"(config_id, domain_user, drive_letter, remote_folder, "
" start, duration, usage_bytes )"
" VALUES (?, ?, ?, ?, ?, ?)",
" VALUES (?, ?, ?, ?, ?, ?, ?)",
(self._config_id, r[0], r[1], r[2], start, duration, r[4] - r[3]))
def sendAllReport(self):
......
......@@ -228,7 +228,7 @@ netuse_list_drive(PyObject *self, PyObject *args)
char szRemoteName[MAX_PATH];
DWORD dwResult;
DWORD cchBuff = MAX_PATH;
char szUserName[MAX_PATH];
char szUserName[MAX_PATH] = {0};
if (! PyArg_ParseTuple(args, "|s", &servername)) {
return NULL;
......@@ -247,9 +247,11 @@ netuse_list_drive(PyObject *self, PyObject *args)
&cchBuff
);
if (dwResult == NO_ERROR) {
dwResult = WNetGetUser("z:",
dwResult = WNetGetUser(drivename,
(LPSTR) szUserName,
&cchBuff);
if (dwResult != NO_ERROR)
snprintf(szUserName, MAX_PATH, "%s", "Unknown User");
pobj = Py_BuildValue("ssss",
drivename,
szRemoteName,
......@@ -670,7 +672,7 @@ static PyMethodDef NetUseMethods[] = {
"When drive is an empty string, the system will automatically\n"
"assigns network drive letters, letters are assigned beginning\n"
"with Z:, then Y:, and ending with C:\n."
"For examples,"
"For examples,\n"
" mapNetDrive(r'\\\\server\\data')\n"
" mapNetDrive(r'\\\\server\\data', 'T:')\n"
" mapNetDrive(r'\\\\server\\data', 'T:', r'\\\\server\\jack', 'abc')\n"
......@@ -711,7 +713,7 @@ static PyMethodDef NetUseMethods[] = {
(
"userInfo()\n\n"
"Get the logon user information, return a tuple:\n"
"(server, domain, user).\n"
" (server, domain, user).\n"
)
},
{NULL, NULL, 0, NULL}
......
......@@ -218,7 +218,7 @@ function configure_section_re6stnet()
csih_inform " ovpnlog"
csih_inform " main-interface ${slapos_ifname}"
csih_inform " interface ${slapos_ifname}"
echo -e "# $subnet\ntable 0\nlog ${_log_path}\novpnlog" \
echo -e "# $subnet\ntable 0\novpnlog" \
"\nmain-interface ${slapos_ifname}\ninterface ${slapos_ifname}" \
>> ${re6stnet_configure_file}
fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment