Пример #1
0
static int http_da_prepareinit(struct soap *soap)
{
  struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id);

  if (!data)
    return SOAP_PLUGIN_ERROR;

  if ((soap->mode & SOAP_IO) != SOAP_IO_STORE && (soap->mode & (SOAP_ENC_DIME | SOAP_ENC_MIME)))
  { /* TODO: handle attachments automatically, does not work yet */
    soap->mode &= ~SOAP_IO;
    soap->mode |= SOAP_IO_STORE;
  }
  else
  {
    if (soap->fpreparerecv == http_da_preparerecv)
      soap->fpreparerecv = data->fpreparerecv;
    if (soap->fdisconnect == http_da_disconnect)
      soap->fdisconnect = data->fdisconnect;

    if (soap->userid && soap->passwd)
    {
      md5_handler(soap, &data->context, MD5_INIT, NULL, 0);
      if (soap->fpreparesend != http_da_preparesend)
      {
        data->fpreparesend = soap->fpreparesend;
        soap->fpreparesend = http_da_preparesend;
      }
    }

    if (data->fprepareinit)
      return data->fprepareinit(soap);
  }

  return SOAP_OK;
}
Пример #2
0
static int http_da_parse(struct soap *soap)
{ 
  struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id);

  if (!data)
    return SOAP_PLUGIN_ERROR;

  data->qop = NULL;

  /* HTTP GET w/o body with qop=auth-int still requires a digest */
  md5_handler(soap, &data->context, MD5_INIT, NULL, 0);
  md5_handler(soap, &data->context, MD5_FINAL, data->digest, 0);

  if ((soap->error = data->fparse(soap)))
    return soap->error;

  if (data->qop && !soap_tag_cmp(data->qop, "auth-int"))
  {
    if (soap->fpreparerecv != http_da_preparerecv)
    {
      data->fpreparerecv = soap->fpreparerecv;
      soap->fpreparerecv = http_da_preparerecv;
    }
    if (soap->fpreparefinalrecv != http_da_preparefinalrecv)
    {
      data->fpreparefinalrecv = soap->fpreparefinalrecv;
      soap->fpreparefinalrecv = http_da_preparefinalrecv;
    }
    md5_handler(soap, &data->context, MD5_INIT, NULL, 0);
  }
 
  return SOAP_OK;
}
Пример #3
0
SOAP_FMAC5 int SOAP_FMAC6 soap_wsa_fault_subcode_action(struct soap *soap,
		int flag, const char *faultsubcode, const char *faultstring,
		const char *faultdetail, const char *action) {
	struct soap_wsa_data *data = (struct soap_wsa_data*) soap_lookup_plugin(
			soap, soap_wsa_id);
	struct SOAP_ENV__Header *oldheader, *newheader;
	DBGFUN2("soap_wsa_fault_subcode", "faultsubcode=%s",
			faultsubcode ? faultsubcode : "(null)", "faultstring=%s",
			faultstring ? faultstring : "(null)");
	if (!data)
		return soap->error = SOAP_PLUGIN_ERROR;
	oldheader = soap->header;
	/* no FaultTo: use ReplyTo */
	if (oldheader && oldheader->SOAP_WSA(ReplyTo)
			&& (!oldheader->SOAP_WSA(FaultTo)
					|| soap_tagsearch(soap_wsa_allAnonymousURI,
							oldheader->SOAP_WSA(FaultTo)->Address))) {
		if (!oldheader->SOAP_WSA(FaultTo)) {
			oldheader->SOAP_WSA(FaultTo) = (SOAP_WSA_(,FaultTo)*) my_soap_malloc(
					soap, sizeof(SOAP_WSA_(,FaultTo)));
			SOAP_WSA_(soap_default,EndpointReferenceType)(soap,
					soap->header->SOAP_WSA(FaultTo));
		}
		oldheader->SOAP_WSA(FaultTo)->Address =
				oldheader->SOAP_WSA(ReplyTo)->Address;
	}
Пример #4
0
static void http_md5_delete(struct soap *soap, struct soap_plugin *p)
{ struct http_md5_data *data = (struct http_md5_data*)soap_lookup_plugin(soap, http_md5_id);
  if (data)
  { md5_handler(soap, &data->context, MD5_DELETE, NULL, 0);
    SOAP_FREE(soap, data);
  }
}
Пример #5
0
static int http_da_parse(struct soap *soap)
{ 
  struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id);

  if (!data)
    return SOAP_PLUGIN_ERROR;

  data->qop = NULL;

  /* HTTP GET w/o body with qop=auth-int still requires a digest */
  if (soap_smd_init(soap, &data->smd_data, SOAP_SMD_DGST_MD5, NULL, 0)
   || soap_smd_final(soap, &data->smd_data, data->digest, NULL))
    return soap->error;

  if ((soap->error = data->fparse(soap)))
    return soap->error;

  if (data->qop && !soap_tag_cmp(data->qop, "auth-int"))
  {
    if (soap->fpreparerecv != http_da_preparerecv)
    {
      data->fpreparerecv = soap->fpreparerecv;
      soap->fpreparerecv = http_da_preparerecv;
    }
    if (soap->fpreparefinalrecv != http_da_preparefinalrecv)
    {
      data->fpreparefinalrecv = soap->fpreparefinalrecv;
      soap->fpreparefinalrecv = http_da_preparefinalrecv;
    }
    if (soap_smd_init(soap, &data->smd_data, SOAP_SMD_DGST_MD5, NULL, 0))
      return soap->error;
  }
 
  return SOAP_OK;
}
Пример #6
0
static int http_connect(struct soap *soap, const char *endpoint, const char *host, int port, const char *path, const char *action, size_t count)
{ struct http_get_data *data = (struct http_get_data*)soap_lookup_plugin(soap, http_get_id);
  if (!data)
    return SOAP_PLUGIN_ERROR;
  soap->status = SOAP_GET;
  soap->fpost = data->fpost;
  return soap->fpost(soap, endpoint, host, port, path, action, count);
}
Пример #7
0
int32 LoginRESTService::ContentTypePlugin::OnSetHeader(soap* s, char const* key, char const* value)
{
    ContentTypePlugin* self = reinterpret_cast<ContentTypePlugin*>(soap_lookup_plugin(s, PluginId));
    if (key && !strcmp("Content-Type", key))
        value = self->ContentType;

    return self->fposthdr(s, key, value);
}
Пример #8
0
static int logging_send(struct soap *soap, const char *buf, size_t len)
{ struct logging_data *data = (struct logging_data*)soap_lookup_plugin(soap, logging_id);
  /* update should be in mutex, but we don't mind some inaccuracy in the count */
  data->stat_sent += len;
  if (data->outbound)
    fwrite(buf, len, 1, data->outbound);
  return data->fsend(soap, buf, len); /* pass data on to old send callback */
}
Пример #9
0
static size_t logging_recv(struct soap *soap, char *buf, size_t len)
{ struct logging_data *data = (struct logging_data*)soap_lookup_plugin(soap, logging_id);
  size_t res = data->frecv(soap, buf, len); /* get data from old recv callback */
  data->stat_recv += res;
  /* update should be in mutex, but we don't mind some inaccuracy in the count */
  if (data->inbound)
    fwrite(buf, res, 1, data->inbound);
  return res;
}
Пример #10
0
int soap_get_connect(struct soap *soap, const char *endpoint, const char *action)
{ struct http_get_data *data = (struct http_get_data*)soap_lookup_plugin(soap, http_get_id);
  if (!data)
    return soap->error = SOAP_PLUGIN_ERROR;
  soap_begin(soap);
  data->fpost = soap->fpost;
  soap->fpost = http_connect;
  return soap_connect(soap, endpoint, action);
}
Пример #11
0
static int http_fdel(struct soap *soap)
{ struct http_post_data *data = (struct http_post_data*)soap_lookup_plugin(soap, http_post_id);
  if (!data)
    return SOAP_PLUGIN_ERROR;
  soap->fform = http_lookup_handler(soap, "DELETE", data);
  if (soap->fform)
    return SOAP_STOP;
  return 405;
}
Пример #12
0
 /* get logging sent and recv octet counts */
 void soap_get_logging_stats(struct soap *soap, size_t *sent, size_t *recv)
 {
     struct logging_data *data = (struct logging_data*)soap_lookup_plugin(soap, logging_id);
     if (data)
     {
         *sent = data->stat_sent;
         *recv = data->stat_recv;
     }
 }
Пример #13
0
static int http_md5_preparerecv(struct soap *soap, const char *buf, size_t len)
{ struct http_md5_data *data = (struct http_md5_data*)soap_lookup_plugin(soap, http_md5_id);
  if (!data)
    return SOAP_PLUGIN_ERROR;
  md5_handler(soap, &data->context, MD5_UPDATE, (char*)buf, len);
  if (data->fpreparerecv)
    return data->fpreparerecv(soap, buf, len);
  return SOAP_OK;
}
Пример #14
0
static int http_fput(struct soap *soap)
{ struct http_post_data *data = (struct http_post_data*)soap_lookup_plugin(soap, http_post_id);
  if (!data)
    return SOAP_PLUGIN_ERROR;
  soap->fform = http_lookup_handler(soap, "PUT", data);
  if (soap->fform)
    return SOAP_FORM;
  return 405;
}
Пример #15
0
void grisu_soap_logging(gboolean state)
{
struct logging_data *logdata;

/* retrieve data struct */
logdata = (struct logging_data *) soap_lookup_plugin(&soap, logging_id);
if (!logdata)
  {
  if (soap_register_plugin(&soap, logging))
     soap_print_fault(&soap, stderr);
  else
    {
/* register plugin if not loaded */
    printf("Loaded gsoap logging plugin...\n");
    logdata = (struct logging_data *) soap_lookup_plugin(&soap, logging_id);
    }
  }

/* set logging state */
if (logdata)
  {
  if (state)
    {
/* TODO - open and write something to indicate logging on/off switches? */
/* then append rather than overwrite (for clarity) */
//    logdata->inbound = stdout; 
//    logdata->outbound = stdout;
//    logdata->inbound = fopen("/home/sean/prog/gdis/RECV.log", "at");
//    logdata->outbound = fopen("/home/sean/prog/gdis/SENT.log", "at");
    logdata->outbound = fopen(GSOAP_LOGGING_SENT, "wt");
    logdata->inbound = fopen(GSOAP_LOGGING_RECV, "wt");
    }
  else
    {
    logdata->inbound = NULL; 
    logdata->outbound = NULL;
    }
// process messages 
//  size_t bytes_in = logdata->stat_recv;
//  size_t bytes_out = logdata->stat_sent;
  }
else
  printf("Gsoap logging plugin not found.\n");
}
Пример #16
0
static const char *
wininet_error_message(
    struct soap *   soap,
    DWORD           a_dwErrorMsgId )
{
    HINSTANCE   hModule;
    DWORD       dwResult;
    DWORD       dwFormatFlags;
    struct wininet_data * pData =
        (struct wininet_data *) soap_lookup_plugin( soap, wininet_id );

    /* free any existing error message */
    wininet_free_error_message( pData );

    dwFormatFlags =
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_IGNORE_INSERTS |
        FORMAT_MESSAGE_FROM_SYSTEM;

    /* load wininet.dll for the error messages */
    hModule = LoadLibraryExA( "wininet.dll", NULL,
        LOAD_LIBRARY_AS_DATAFILE | DONT_RESOLVE_DLL_REFERENCES );
    if ( hModule )
    {
        dwFormatFlags |= FORMAT_MESSAGE_FROM_HMODULE;
    }

    /* format the messages */
    dwResult = FormatMessageA(
        dwFormatFlags,
        hModule,
        a_dwErrorMsgId,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPSTR) &pData->pszErrorMessage,
        0,
        NULL );

    /* free the library if we loaded it */
    if ( hModule )
    {
        FreeLibrary( hModule );
    }

    /* remove the CR LF from the error message */
    if ( dwResult > 2 )
    {
        pData->pszErrorMessage[dwResult-2] = 0;
        return pData->pszErrorMessage;
    }
    else
    {
        const static char szUnknown[] = "(unknown)";
        return szUnknown;
    }
}
Пример #17
0
static int http_da_parse_header(struct soap *soap, const char *key, const char *val)
{
  struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id);

  if (!data)
    return SOAP_PLUGIN_ERROR;

  /* check if server received Authorization Digest HTTP header from client */
  if (!soap_tag_cmp(key, "Authorization") && !soap_tag_cmp(val, "Digest *"))
  {
    soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "realm"));
    soap->userid = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "username"));
    soap->passwd = NULL;
    data->nonce = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "nonce"));
    data->opaque = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "opaque"));
    data->qop = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "qop"));
    data->alg = NULL;
    data->ncount = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "nc"));
    data->cnonce = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "cnonce"));
    data->response = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "response"));
    if (data->qop && !soap_tag_cmp(data->qop, "auth-int"))
    {
      if (soap->fpreparerecv != http_da_preparerecv)
      {
        data->fpreparerecv = soap->fpreparerecv;
        soap->fpreparerecv = http_da_preparerecv;
      }
      if (soap->fdisconnect != http_da_disconnect)
      {
        data->fdisconnect = soap->fdisconnect;
        soap->fdisconnect = http_da_disconnect;
      }
      md5_handler(soap, &data->context, MD5_INIT, NULL, 0);
    }
    return SOAP_OK;
  }

  /* check if client received WWW-Authenticate Digest HTTP header from server */
  if (!soap_tag_cmp(key, "WWW-Authenticate") && !soap_tag_cmp(val, "Digest *"))
  {
    soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "realm"));
    data->nonce = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "nonce"));
    data->opaque = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "opaque"));
    data->qop = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "qop"));
    data->alg = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "algorithm"));
    data->nc = 1;
    data->ncount = NULL;
    data->cnonce = NULL;
    data->response = NULL;
    return SOAP_OK;
  }

  return data->fparsehdr(soap, key, val);
}
Пример #18
0
SOAP_FMAC5 int SOAP_FMAC6 soap_wsa_response(struct soap *soap, int status,
		size_t count) {
	struct soap_wsa_data *data = (struct soap_wsa_data*) soap_lookup_plugin(
			soap, soap_wsa_id);
	DBGFUN2("soap_wsa_response", "status=%d", status, "count=%lu",
			(unsigned long) count);
	if (!data)
		return SOAP_PLUGIN_ERROR;
	soap->fresponse = data->fresponse; /* reset (HTTP response) */
	return soap->fpost(soap, soap_strdup(soap, soap->endpoint), soap->host,
			soap->port, soap->path, soap->action, count);
}
Пример #19
0
static int http_da_parse_header(struct soap *soap, const char *key, const char *val)
{
  struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id);

  if (!data)
    return SOAP_PLUGIN_ERROR;

  /* check if server received Authorization Digest HTTP header from client */
  if (!soap_tag_cmp(key, "Authorization") && !soap_tag_cmp(val, "Digest *"))
  {
    data->alg = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "algorithm"));
    soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "realm"));
    soap->userid = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "username"));
    soap->passwd = NULL;
    data->nonce = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "nonce"));
    data->opaque = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "opaque"));
    data->qop = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "qop"));
    data->ncount = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "nc"));
    data->cnonce = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "cnonce"));
    (void)soap_hex2s(soap, soap_get_header_attribute(soap, val + 7, "response"), data->response, 32, NULL);
    return SOAP_OK;
  }

  /* check if client received WWW-Authenticate Digest HTTP header from server */
  if ((!soap_tag_cmp(key, "WWW-Authenticate") || !soap_tag_cmp(key, "Proxy-Authenticate")) && !soap_tag_cmp(val, "Digest *"))
  {
    const char *authrealm = soap_get_header_attribute(soap, val + 7, "realm");
    if (authrealm && (!soap->authrealm || strcmp(authrealm, soap->authrealm)))
    {
      const char *alg;
      soap->authrealm = soap_strdup(soap, authrealm);
      alg = soap_get_header_attribute(soap, val + 7, "algorithm");
      if (!alg || soap_tag_cmp(alg, "SHA-512-256*"))
      {
        /* got the first authenticate header for this realm that we can accept */
        data->alg = soap_strdup(soap, alg);
        data->nonce = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "nonce"));
        data->opaque = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "opaque"));
        data->qop = soap_strdup(soap, soap_get_header_attribute(soap, val + 7, "qop"));
        data->nc = 1;
        data->ncount = NULL;
        data->cnonce = NULL;
      }
      else
      {
        soap->authrealm = NULL;
      }
    }
    return SOAP_OK;
  }

  return data->fparsehdr(soap, key, val);
}
Пример #20
0
void
wininet_set_rse_callback(
    struct soap *           soap,
    wininet_rse_callback    a_pRsecallback)
{
    struct wininet_data * pData = (struct wininet_data *) soap_lookup_plugin( soap, wininet_id );

    DBGLOG(TEST, SOAP_MESSAGE(fdebug,
        "wininet %p: resolve_send_error callback = '%p'\n", soap, a_pRsecallback ));

    pData->pRseCallback = a_pRsecallback;
}
Пример #21
0
static int http_md5_post_header(struct soap *soap, const char *key, const char *val)
{ struct http_md5_data *data = (struct http_md5_data*)soap_lookup_plugin(soap, http_md5_id);
  char buf64[25]; /* 24 base64 chars + '\0' */
  int err;
  if (!data)
    return SOAP_PLUGIN_ERROR;
  if (!key) /* last line */
  { if ((err = md5_handler(soap, &data->context, MD5_FINAL, data->digest, 0)))
      return err;
    data->fposthdr(soap, "Content-MD5", soap_s2base64(soap, (unsigned char*)data->digest, buf64, 16));
  }
  return data->fposthdr(soap, key, val);
}
Пример #22
0
void http_da_restore(struct soap *soap, struct http_da_info *info)
{
  struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id);
  if (!data)
    return;
  soap->authrealm = info->authrealm;
  soap->userid = info->userid;
  soap->passwd = info->passwd;
  data->nonce = info->nonce;
  data->opaque = info->opaque;
  data->qop = info->qop;
  data->alg = info->alg;
}
Пример #23
0
void http_da_save(struct soap *soap, struct http_da_info *info, const char *realm, const char *userid, const char *passwd)
{
  struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id);
  if (!data)
    return;
  info->authrealm = soap->authrealm = soap_strdup(NULL, realm);
  info->userid = soap->userid = soap_strdup(NULL, userid);
  info->passwd = soap->passwd = soap_strdup(NULL, passwd);
  info->nonce = soap_strdup(NULL, data->nonce);
  info->opaque = soap_strdup(NULL, data->opaque);
  info->qop = soap_strdup(NULL, data->qop);
  info->alg = soap_strdup(NULL, data->alg);
}
Пример #24
0
void http_da_release(struct soap *soap, struct http_da_info *info)
{
  struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id);
  if (!data)
    return;

  soap->authrealm = NULL;
  soap->userid = NULL;
  soap->passwd = NULL;

  data->nonce = NULL;
  data->opaque = NULL;
  data->qop = NULL;
  data->alg = NULL;

  if (info->authrealm)
  {
    free((void*)info->authrealm);
    info->authrealm = NULL;
  }
  if (info->userid)
  {
    free((void*)info->userid);
    info->userid = NULL;
  }
  if (info->passwd)
  {
    free((void*)info->passwd);
    info->passwd = NULL;
  }
  if (info->nonce)
  {
    free((void*)info->nonce);
    info->nonce = NULL;
  }
  if (info->opaque)
  {
    free((void*)info->opaque);
    info->opaque = NULL;
  }
  if (info->qop)
  {
    free((void*)info->qop);
    info->qop = NULL;
  }
  if (info->alg)
  {
    free((void*)info->alg);
    info->alg = NULL;
  }
}
Пример #25
0
static int http_md5_disconnect(struct soap *soap)
{ struct http_md5_data *data = (struct http_md5_data*)soap_lookup_plugin(soap, http_md5_id);
  char digest[16];
  if (!data)
    return SOAP_PLUGIN_ERROR;
  md5_handler(soap, &data->context, MD5_FINAL, digest, 0);
  soap->fpreparerecv = data->fpreparerecv;
  soap->fdisconnect = data->fdisconnect;
  if (memcmp(digest, data->digest, 16))
    return soap_sender_fault(soap, "MD5 digest mismatch: message corrupted", NULL);
  if (soap->fdisconnect)
    return soap->fdisconnect(soap);
  return SOAP_OK;
}
Пример #26
0
static int http_md5_parse_header(struct soap *soap, const char *key, const char *val)
{ struct http_md5_data *data = (struct http_md5_data*)soap_lookup_plugin(soap, http_md5_id);
  if (!data)
    return SOAP_PLUGIN_ERROR;
  if (!soap_tag_cmp(key, "Content-MD5"))
  { soap_base642s(soap, val, data->digest, 16, NULL);
    data->fpreparerecv = soap->fpreparerecv;
    soap->fpreparerecv = http_md5_preparerecv;
    data->fdisconnect = soap->fdisconnect;
    soap->fdisconnect = http_md5_disconnect;
    return SOAP_OK;
  }
  return data->fparsehdr(soap, key, val);
}
Пример #27
0
static int http_da_preparerecv(struct soap *soap, const char *buf, size_t len)
{
  struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id);

  if (!data)
    return SOAP_PLUGIN_ERROR;

  if (soap_smd_update(soap, &data->smd_data, buf, len))
    return soap->error;

  if (data->fpreparerecv)
    return data->fpreparerecv(soap, buf, len);

  return SOAP_OK;
}
Пример #28
0
int gsi_authorization_callback(struct soap *soap, char *distinguished_name)
{
	char buf[256] = { '\0' };
	char *auth;
	char *auth_file;
	FILE *fd;

	struct gsi_plugin_data *data;

	data = (struct gsi_plugin_data *) soap_lookup_plugin(soap, GSI_PLUGIN_ID);

	auth = globus_libc_getenv("AUTHORIZATION_FILE");
	if (auth != NULL) {
		auth_file = strdup(auth);
	} else {
		auth_file = strdup(AUTHORIZATION_FILE);
	}

	fd = fopen(auth_file, "r");

	if (!fd) {

		globus_libc_printf("Can not read file: %s\n", auth_file);
		return 1;
	}
	while (fgets(buf, 512, fd) != NULL) {
		buf[strlen(buf) - 1] = '\0';
		if (!strcmp(distinguished_name, buf)) {

			if (auth)
				free(auth);
			if (auth_file)
				free(auth_file);

			fclose(fd);

			return 0;
		}
	}
	if (auth)
		free(auth);
	if (auth_file)
		free(auth_file);
	fclose(fd);

	globus_libc_printf("Sorry, service %s is not authorized\n", distinguished_name);
	return 1;
}
Пример #29
0
static int http_post_parse_header(struct soap *soap, const char *key, const char *val)
{ struct http_post_data *data = (struct http_post_data*)soap_lookup_plugin(soap, http_post_id);
  if (!data)
    return SOAP_PLUGIN_ERROR;
  soap->error = data->fparsehdr(soap, key, val); /* parse HTTP header */
  if (soap->error == SOAP_OK)
  { if (!soap_tag_cmp(key, "Content-Type"))
    { /* check content type: you can filter any type of payloads here */
      if (!soap_tag_cmp(val, "application/x-www-form-urlencoded"))
        soap->error = SOAP_FORM; /* delegate body parsing to handler */
      else if (!soap_tag_cmp(val, "image/*"))
        soap->error = SOAP_FORM; /* delegate images of any type */
    }
  }
  return soap->error;
}
Пример #30
0
static int http_da_disconnect(struct soap *soap)
{
  struct http_da_data *data = (struct http_da_data*)soap_lookup_plugin(soap, http_da_id);

  if (!data)
    return SOAP_PLUGIN_ERROR;

  md5_handler(soap, &data->context, MD5_FINAL, data->digest, 0);

  soap->fpreparerecv = data->fpreparerecv;
  soap->fdisconnect = data->fdisconnect;

  if (soap->fdisconnect)
    return soap->fdisconnect(soap);

  return SOAP_OK;
}