agent.c revision 58a77c7622bb738b4b84816838dd870b40409a54
/**
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014 - 2015 ForgeRock AS.
*/
#include "platform.h"
#include "version.h"
#include "am.h"
#include <httpserv.h>
#define AM_MOD_SECTION L"system.webServer/OpenAmModule"
#define AM_MOD_SECTION_ENABLED L"enabled"
#define AM_MOD_SECTION_CONFIGFILE L"configFile"
struct process_wait {
int pid;
};
return HRESULT_CODE(hr);
}
return ERROR_SUCCESS;
}
return ERROR_CAN_NOT_COMPLETE;
}
}
return ret;
}
if (out_len > 0) {
}
return tmp;
}
return NULL;
}
if (out_len > 0) {
}
return tmp;
}
return NULL;
}
public :
}
~OpenAMStoredConfig() {
}
}
}
void CleanupStoredContext() {
}
return enabled;
}
char *GetPath(IHttpContext * r) {
}
am_config_t * GetBootConf() {
return aconf;
}
if (pMetadataContainer == NULL) {
return E_UNEXPECTED;
}
if (pModuleConfig != NULL) {
return S_OK;
}
if (pModuleConfig == NULL) {
return E_OUTOFMEMORY;
}
return E_UNEXPECTED;
}
return S_OK;
}
}
return hr;
}
do {
if (pAdminManager == NULL) {
hr = E_UNEXPECTED;
break;
}
break;
}
hr = E_UNEXPECTED;
break;
}
break;
}
hr = E_UNEXPECTED;
break;
}
break;
}
hr = E_UNEXPECTED;
break;
}
}
} while (FALSE);
return hr;
}
do {
hr = E_INVALIDARG;
break;
}
hr = E_UNEXPECTED;
break;
}
*pException = NULL;
if (*pException != NULL) {
hr = E_UNEXPECTED;
break;
}
} while (FALSE);
}
return hr;
}
do {
hr = E_INVALIDARG;
break;
}
hr = E_UNEXPECTED;
break;
}
*pException = NULL;
if (*pException != NULL) {
hr = E_UNEXPECTED;
break;
}
hr = E_OUTOFMEMORY;
break;
}
} while (FALSE);
}
return hr;
}
};
public :
return userName;
}
return userName;
}
return L"OpenAM";
}
}
return hToken;
}
}
return NULL;
}
}
if (InterlockedDecrement(&m_refs) <= 0) {
}
}
return FALSE;
}
return E_NOTIMPL;
}
return NULL;
}
m_refs = 1;
if (dologon) {
error = GetLastError();
if (status) {
}
} else {
}
} else {
}
}
return status;
}
return error;
}
virtual ~OpenAMHttpUser() {
}
};
const char* thisfunc = "get_server_variable():";
"%s server variable %s is not available in HttpContext (error: %d)",
} else {
}
return val;
}
status = AM_SUCCESS;
}
} else {
}
}
return status;
}
const char *thisfunc = "set_header_in_request():";
/* remove all instances of the header first */
}
value_data[value_sz] = 0;
return AM_ERROR;
}
} else {
return AM_ENOMEM;
}
}
return AM_SUCCESS;
}
const char *thisfunc = "set_cookie():";
const char *cookie;
char *header_data;
if (header_data != NULL) {
header_data[header_sz] = 0;
status = AM_SUCCESS;
} else {
am_log_warning(rq->instance_id, "%s failed to set response header Set-Cookie value %s (%d)", thisfunc,
}
} else {
}
} else {
if (new_cookie != NULL) {
} else {
}
}
return status;
}
const char *thisfunc = "add_header_in_response():";
/*value is empty, sdk is setting a cookie in response*/
} else {
value_data[value_sz] = 0;
status = AM_SUCCESS;
} else {
}
} else {
}
}
return status;
}
switch (v) {
case AM_SUCCESS:
return RQ_NOTIFICATION_CONTINUE;
case AM_EAGAIN:
return RQ_NOTIFICATION_PENDING;
case AM_PDP_DONE:
case AM_DONE:
return RQ_NOTIFICATION_FINISH_REQUEST;
case AM_NOT_HANDLING:
return RQ_NOTIFICATION_CONTINUE;
case AM_NOT_FOUND:
return RQ_NOTIFICATION_FINISH_REQUEST;
case AM_REDIRECT:
return RQ_NOTIFICATION_FINISH_REQUEST;
case AM_FORBIDDEN:
return RQ_NOTIFICATION_FINISH_REQUEST;
case AM_BAD_REQUEST:
return RQ_NOTIFICATION_FINISH_REQUEST;
case AM_ERROR:
return RQ_NOTIFICATION_FINISH_REQUEST;
case AM_NOT_IMPLEMENTED:
return RQ_NOTIFICATION_FINISH_REQUEST;
default:
return RQ_NOTIFICATION_FINISH_REQUEST;
}
}
return AM_ERROR;
}
return AM_SUCCESS;
}
const char *thisfunc = "set_request_body():";
}
} else {
}
}
if (status != AM_SUCCESS) {
}
return status;
}
const char *thisfunc = "get_request_body():";
if (r->GetRemainingEntityBytes() > 0) {
while (r->GetRemainingEntityBytes() != 0) {
return AM_ERROR;
}
}
read_bytes += rc;
out[read_bytes] = 0;
status = AM_SUCCESS;
}
}
if (status == AM_SUCCESS) {
r->DeleteHeader("CONTENT_LENGTH");
}
return status;
}
int i;
for (i = 0; i<sizeof (keyHeader); i++) {
}
for (i = 0; i<sizeof (keyLen); i++) {
}
for (i = 0; i < 8; i++) {
}
if (CryptImportKey(hCryptProv, (BYTE*) & bKey, sizeof (keyHeader) + sizeof (DWORD) + 8, 0, 0, &hKey)) {
status = AM_SUCCESS;
}
}
}
}
return status;
}
public :
userPassword = NULL;
userPasswordSize = 0;
}
if (clonedContext != NULL) {
}
return RQ_NOTIFICATION_CONTINUE;
}
IHttpEventProvider * prov) {
const char *thisfunc = "OpenAMHttpModule():";
int rv;
am_request_t d;
char ip[INET6_ADDRSTRLEN];
/* agent module is not enabled for this
**/
return RQ_NOTIFICATION_CONTINUE;
}
return RQ_NOTIFICATION_CONTINUE;
}
/* register and update instance logger configuration (for already registered
* instances - update logging level only)
*/
} else {
return RQ_NOTIFICATION_FINISH_REQUEST;
}
return RQ_NOTIFICATION_FINISH_REQUEST;
}
/* set up request processor data structure */
memset(&d, 0, sizeof (am_request_t));
d.conf->client_ip_header);
}
unsigned long s = sizeof (ip);
if (b != NULL) *b = 0;
}
} else {
char *b;
if (ip[0] == '[') {
}
if (b != NULL) *b = 0;
}
}
}
}
}
d.am_set_user_f = set_user;
am_process_request(&d);
am_config_free(&d.conf);
am_request_free(&d);
am_log_debug(site->GetSiteId(), "%s exit status: %s (%d)", thisfunc, am_strerror(d.status), d.status);
return status;
}
if (currentUser == NULL) {
am_log_error(site->GetSiteId(), "OpenAMHttpModule(): failed (invalid Windows/AD user credentials). "
return RQ_NOTIFICATION_FINISH_REQUEST;
} else {
}
}
}
return RQ_NOTIFICATION_CONTINUE;
}
}
}
return RQ_NOTIFICATION_CONTINUE;
}
void WriteEventLog(const char *format, ...) {
}
if (count > 0) {
if (formattedString != NULL) {
}
}
}
}
char *userName;
};
const char *thisfunc = "set_user():";
}
}
char *user_passwd = NULL;
}
m->userPasswordCrypted = utf8_decode(r, rq->user_password, (size_t *) & m->userPasswordCryptedSize);
}
return AM_SUCCESS;
}
const char *thisfunc = "set_custom_response():";
} else {
}
} else {
} else {
char tls[64];
r->GetResponse()->Clear();
}
} else {
}
}
}
return AM_SUCCESS;
}
public :
}
}
}
}
}
return S_OK;
}
am_shutdown();
}
};
}
public :
if (prov->IsProcessRecycled()) {
malloc(sizeof (struct process_wait));
}
}
}
}
return GL_NOTIFICATION_CONTINUE;
}
}
};
do {
break;
}
break;
}
break;
}
break;
}
break;
}
break;
}
} while (FALSE);
}
}
return status;
}