I have built a shared module on apache 2.4. I could get the apache build succesfull. On apache start there is a dump at the below line:
if (r != NULL) ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r, "test");
I derefernce the structure variable r which is of type server_rec(apache struct) and below is the value in dbx
(dbx) p *r
(process = 0x000000011001fa88, next = (nil), error_fname = "logs/error_log", error_log = 0x000000011001fa10, log = (module_levels = (nil), level = 4), module_config = 0x0000000110053420, lookup_defaults = 0x0000000110054ef8, defn_name = (nil), defn_line_number = 0, is_virtual = '\0', port = 0, server_scheme = (nil), server_admin = "you#example.com", server_hostname = "isi081.wdf.sap.corp", addrs = 0x000000011004e410, timeout = 60000000, keep_alive_timeout = 5000000, keep_alive_max = 100, keep_alive = 1, names = (nil), wild_names = (nil), path = (nil), pathlen = 0, limit_req_line = 8190, limit_req_fieldsize = 8190, limit_req_fields = 100, context = (nil))
I do not see any corruption in memory. But still there is a dump on apache start.
If i comment out this line, then everything works as expected. Apache starts and i am able to complete the operation as well. But we would need this statement in order to have logging enabled. Is there any other alternative or fix for the same.
The same code is working for other platforms like linux,solaris and HP on apache 2.4.
ALso on aix with apache 2.2 the same code works. Only on apache 2.4 this issue is observed.
Any help would be highly appreciated.
I'm thinking you did not fully compile against 2.4 headers, and "ap_log_error" was not treated as the macro it is in 2.4.
Also, that server_rec named "r" is super misleading. "r" is traditionally a request_rec. I can't believe it's not actually the source of your problem, and maybe it is somehow indirectly.
Related
My script is working so far to open a remote FTP connection, change directory, and download a file. My last two steps would be to delete the remove file once it's fully downloaded and then close the connection. ACF documentation (and cfdocs) seems to have very little information on this. Here's what I have so far:
ftpConnection = ftpService.open(
action = 'open',
connection = variables.ftpConnectionName,
server = variables.ftpServerName,
username = '***************',
password = '***************',
secure='true');
if( ftpConnection.getPrefix().succeeded ){
fileList = ftpService.listdir(directory = variables.ftpPath, connection= variables.ftpConnectionName, name='pendingFiles', stopOnError='true').getResult();
if( fileList.recordCount ){
changeFtpConnectionDir = ftpService.changeDir(
connection = variables.ftpConnectionName,
directory = variables.ftpPath);
getFtpConnection = ftpService.getFile(
connection = variables.ftpConnectionName,
remoteFile = fileList.name,
localFile = local.localPath & fileList.name,
failIfExists = false,
timeout = 3000
);
deleteRemoteFile = ftpService.remove(
connection = variables.ftpConnectionName,
remoteFile = fileList.name
};
closeFtp = ftpService.close(
connection = variables.ftpConnectionName
);
};
};
Error is thrown on the remoteFile = fileList.name. Since I already changed directory I don't think I need to put the full path here.
I put the entire script up since there doesn't seem to be many resources out there about using the newer ftpServer() functions.
D'oh - my issue was a typo:
deleteRemoteFile = ftpService.remove(
connection = variables.ftpConnectionName,
remoteFile = fileList.name
);// had } instead of )
I'll still leave this up as a resource for ftpService()
Using Windows Filtering Platform i need to block all computer applications minus 1 especific aplication ?
Tried this code and does not work, it blocks all trafic :(
fwpFilter.layerKey = FWPM_LAYER_ALE_AUTH_CONNECT_V4;
fwpFilter.action.type = FWP_ACTION_BLOCK;
fwpFilter.subLayerKey = subLayerKey;
fwpFilter.weight.type = FWP_EMPTY;
fwpFilter.numFilterConditions = 0;
fwpFilter.displayData.name = GetWC("Block All APPS MINUS FIREFOX");
fwpFilter.displayData.description = GetWC("Block All APPS MINUS FIREFOX");
result = FwpmFilterAdd0(engine, &fwpFilter, NULL, NULL);
FWPM_FILTER_CONDITION0 Condition;
fwpFilter.layerKey = FWPM_LAYER_ALE_AUTH_CONNECT_V4;
fwpFilter.action.type = FWP_ACTION_PERMIT;
fwpFilter.weight.type = FWP_EMPTY;
fwpFilter.filterCondition = &Condition;
fwpFilter.numFilterConditions = 1;
PCWSTR appPath = (PCWSTR)GetWC("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
FWP_BYTE_BLOB *fwpApplicationByteBlob;
fwpApplicationByteBlob = (FWP_BYTE_BLOB*)malloc(sizeof(FWP_BYTE_BLOB));
FwpmGetAppIdFromFileName0(appPath, &fwpApplicationByteBlob);
Condition.fieldKey = FWPM_CONDITION_ALE_APP_ID;
Condition.matchType = FWP_MATCH_EQUAL;
Condition.conditionValue.type = FWP_BYTE_BLOB_TYPE;
Condition.conditionValue.byteBlob = fwpApplicationByteBlob;
result = FwpmFilterAdd0(engine, &fwpFilter, NULL, NULL);
Thanks in advance
Below here is a code snippet what I m trying out:
PRINTER_INFO_2 pi;
BOOL Result = FALSE;
HANDLE pHd;
memset(&pi, 0, sizeof(PRINTER_INFO_2));
pi.pPrinterName = L"RxXPSDrv";
pi.pDriverName = L"XPSDrv Sample Driver";
// Select Share Name
pi.pShareName = L"MyPrinter";
// Select Server Name
pi.pServerName = NULL;
// Select Port Name
pi.pPortName = L"COM3:";
//pi.pPortName = L"C:\\Users\\admin\\Desktop\\a1.xps";
pi.pSecurityDescriptor = NULL;
// Select Print Processor
pi.pPrintProcessor = L"winprint";
// Select Attributes
pi.Attributes = PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST | PRINTER_ATTRIBUTE_LOCAL;
// Set Priority
pi.Priority = 1;
// Call the function AddPrinter
pHd = AddPrinter(NULL, 2, (LPBYTE)&pi);
Here #pi.pPortName I need to provide C:\Users\admin\Desktop\a1.xps but its not working and the printer isn't getting added. With COM3 it works fine.
Can anyone tell me how can I do this? How can I provide full path of a XPS to pi.pPortName?
You have to add a "local port" "C:\Users\admin\Desktop\a1.xps" first. I just tried and it worked. Some code for Add port: Adding-a-Local-Port-through-XcvData-and-C
I have a VMWare system. I want to run a python script which shall access the VMWare system via IP and want to create a New Disk.
dev_changes = []
new_disk_kb = int(disk_size) * 1024 * 1024
disk_spec = vim.vm.device.VirtualDeviceSpec()
disk_spec.fileOperation = "create"
disk_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.add
disk_spec.device = vim.vm.device.VirtualDisk()
disk_spec.device.backing = \
vim.vm.device.VirtualDisk.FlatVer2BackingInfo()
if disk_type == 'thin':
disk_spec.device.backing.thinProvisioned = True
disk_spec.device.backing.diskMode = 'persistent'
disk_spec.device.unitNumber = unit_number
disk_spec.device.capacityInKB = new_disk_kb
disk_spec.device.controllerKey = controller.key
dev_changes.append(disk_spec)
spec.deviceChange = dev_changes
vm.ReconfigVM_Task(spec=spec)
print "%sGB disk added to %s" % (disk_size, vm.config.name)
Hope this helps
I am creating a service using CreateService. The service will run again fine if it happens to crash and I would like to have Windows restart the service if it crashes. I know it is possible to set this up from the services msc see below.
How can I programatically configure the service to always restart if it happens to crash.
Used Deltanine's approach, but modified it a bit to be able to control each failure action:
SERVICE_FAILURE_ACTIONS servFailActions;
SC_ACTION failActions[3];
failActions[0].Type = SC_ACTION_RESTART; //Failure action: Restart Service
failActions[0].Delay = 120000; //number of milliseconds to wait before performing failure action = 2minutes
failActions[1].Type = SC_ACTION_RESTART;
failActions[1].Delay = 120000;
failActions[2].Type = SC_ACTION_NONE;
failActions[2].Delay = 120000;
servFailActions.dwResetPeriod = 86400; // Reset Failures Counter, in Seconds = 1day
servFailActions.lpCommand = NULL; //Command to perform due to service failure, not used
servFailActions.lpRebootMsg = NULL; //Message during rebooting computer due to service failure, not used
servFailActions.cActions = 3; // Number of failure action to manage
servFailActions.lpsaActions = failActions;
ChangeServiceConfig2(sc_service, SERVICE_CONFIG_FAILURE_ACTIONS, &servFailActions); //Apply above settings
You want to call ChangeServiceConfig2 after you've installed the service. Set the second parameter to SERVICE_CONFIG_FAILURE_ACTIONS and pass in an instance of SERVICE_FAILURE_ACTIONS as the third parameter, something like this:
int numBytes = sizeof(SERVICE_FAILURE_ACTIONS) + sizeof(SC_ACTION);
std::vector<char> buffer(numBytes);
SERVICE_FAILURE_ACTIONS *sfa = reinterpret_cast<SERVICE_FAILURE_ACTIONS *>(&buffer[0]);
sfa.dwResetPeriod = INFINITE;
sfa.cActions = 1;
sfa.lpsaActions[0].Type = SC_ACTION_RESTART;
sfa.lpsaActions[0].Delay = 5000; // wait 5 seconds before restarting
ChangeServiceConfig2(hService, SERVICE_CONFIG_FAILURE_ACTIONS, sfa);
The answer above will give you the gist... but it wont compile.
try:
SERVICE_FAILURE_ACTIONS sfa;
SC_ACTION actions;
sfa.dwResetPeriod = INFINITE;
sfa.lpCommand = NULL;
sfa.lpRebootMsg = NULL;
sfa.cActions = 1;
sfa.lpsaActions = &actions;
sfa.lpsaActions[0].Type = SC_ACTION_RESTART;
sfa.lpsaActions[0].Delay = 5000;
ChangeServiceConfig2(hService, SERVICE_CONFIG_FAILURE_ACTIONS, &sfa)