https://issues.shibboleth.net/jira/browse/SSPCPP-155
[shibboleth/cpp-sp.git] / nsapi_shib / nsapi_shib.cpp
1 /*
2  *  Copyright 2001-2007 Internet2
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * nsapi_shib.cpp
19  *
20  * Shibboleth NSAPI filter
21  */
22
23 #define SHIBSP_LITE
24
25 #if defined (_MSC_VER) || defined(__BORLANDC__)
26 # include "config_win32.h"
27 #else
28 # include "config.h"
29 #endif
30
31 #ifdef WIN32
32 # define _CRT_NONSTDC_NO_DEPRECATE 1
33 # define _CRT_SECURE_NO_DEPRECATE 1
34 #endif
35
36 #include <shibsp/AbstractSPRequest.h>
37 #include <shibsp/RequestMapper.h>
38 #include <shibsp/SPConfig.h>
39 #include <shibsp/ServiceProvider.h>
40 #include <xmltooling/XMLToolingConfig.h>
41 #include <xmltooling/util/NDC.h>
42 #include <xmltooling/util/Threads.h>
43 #include <xmltooling/util/XMLConstants.h>
44 #include <xmltooling/util/XMLHelper.h>
45 #include <xercesc/util/XMLUniDefs.hpp>
46
47 #include <memory>
48 #include <fstream>
49 #include <sstream>
50 #include <stdexcept>
51
52 #ifdef WIN32
53 # include <process.h>
54 # define XP_WIN32
55 #else
56 # define XP_UNIX
57 #endif
58
59 #define MCC_HTTPD
60 #define NET_SSL
61
62 extern "C"
63 {
64 #include <nsapi.h>
65 }
66
67 using namespace shibsp;
68 using namespace xmltooling;
69 using namespace std;
70
71 // macros to output text to client
72 #define NET_WRITE(str) \
73     if (IO_ERROR==net_write(sn->csd,str,strlen(str))) return REQ_EXIT
74
75 namespace {
76     SPConfig* g_Config=NULL;
77     string g_ServerName;
78     string g_ServerScheme;
79     string g_unsetHeaderValue;
80     string g_spoofKey;
81     bool g_checkSpoofing = true;
82     bool g_catchAll = false;
83
84     static const XMLCh path[] =     UNICODE_LITERAL_4(p,a,t,h);
85     static const XMLCh validate[] = UNICODE_LITERAL_8(v,a,l,i,d,a,t,e);
86 }
87
88 PluginManager<RequestMapper,string,const xercesc::DOMElement*>::Factory SunRequestMapFactory;
89
90 extern "C" NSAPI_PUBLIC void nsapi_shib_exit(void*)
91 {
92     if (g_Config)
93         g_Config->term();
94     g_Config = NULL;
95 }
96
97 extern "C" NSAPI_PUBLIC int nsapi_shib_init(pblock* pb, ::Session* sn, Request* rq)
98 {
99     // Save off a default hostname for this virtual server.
100     char* name=pblock_findval("server-name",pb);
101     if (name)
102         g_ServerName=name;
103     else {
104         name=server_hostname;
105         if (name)
106             g_ServerName=name;
107         else {
108             name=util_hostname();
109             if (name) {
110                 g_ServerName=name;
111                 FREE(name);
112             }
113             else {
114                 pblock_nvinsert("error","unable to determine web server hostname",pb);
115                 return REQ_ABORTED;
116             }
117         }
118     }
119     name=pblock_findval("server-scheme",pb);
120     if (name)
121         g_ServerScheme=name;
122
123     log_error(LOG_INFORM,"nsapi_shib_init",sn,rq,"nsapi_shib loaded for host (%s)",g_ServerName.c_str());
124
125     const char* schemadir=pblock_findval("shib-schemas",pb);
126     const char* prefix=pblock_findval("shib-prefix",pb);
127
128     g_Config=&SPConfig::getConfig();
129     g_Config->setFeatures(
130         SPConfig::Listener |
131         SPConfig::Caching |
132         SPConfig::RequestMapping |
133         SPConfig::InProcess |
134         SPConfig::Logging |
135         SPConfig::Handlers
136         );
137     if (!g_Config->init(schemadir,prefix)) {
138         g_Config=NULL;
139         pblock_nvinsert("error","unable to initialize Shibboleth libraries",pb);
140         return REQ_ABORTED;
141     }
142
143     g_Config->RequestMapperManager.registerFactory(NATIVE_REQUEST_MAPPER,&SunRequestMapFactory);
144
145     try {
146         if (!g_Config->instantiate(pblock_findval("shib-config",pb), true))
147             throw runtime_error("unknown error");
148     }
149     catch (exception& ex) {
150         pblock_nvinsert("error",ex.what(),pb);
151         g_Config->term();
152         g_Config=NULL;
153         return REQ_ABORTED;
154     }
155
156     daemon_atrestart(nsapi_shib_exit,NULL);
157
158     ServiceProvider* sp=g_Config->getServiceProvider();
159     Locker locker(sp);
160     const PropertySet* props=sp->getPropertySet("InProcess");
161     if (props) {
162         pair<bool,const char*> unsetValue=props->getString("unsetHeaderValue");
163         if (unsetValue.first)
164             g_unsetHeaderValue = unsetValue.second;
165         pair<bool,bool> flag=props->getBool("checkSpoofing");
166         g_checkSpoofing = !flag.first || flag.second;
167         if (g_checkSpoofing) {
168             unsetValue=props->getString("spoofKey");
169             if (unsetValue.first)
170                 g_spoofKey = unsetValue.second;
171         }
172         flag=props->getBool("catchAll");
173         g_catchAll = flag.first && flag.second;
174     }
175     return REQ_PROCEED;
176 }
177
178 /********************************************************************************/
179 // NSAPI Shib Target Subclass
180
181 class ShibTargetNSAPI : public AbstractSPRequest
182 {
183   mutable string m_body;
184   mutable bool m_gotBody,m_firsttime;
185   mutable vector<string> m_certs;
186   set<string> m_allhttp;
187
188 public:
189   pblock* m_pb;
190   ::Session* m_sn;
191   Request* m_rq;
192
193   ShibTargetNSAPI(pblock* pb, ::Session* sn, Request* rq)
194       : AbstractSPRequest(SHIBSP_LOGCAT".NSAPI"), m_gotBody(false), m_firsttime(true), m_pb(pb), m_sn(sn), m_rq(rq) {
195
196     const char* uri=pblock_findval("uri", rq->reqpb);
197     const char* qstr=pblock_findval("query", rq->reqpb);
198
199     if (qstr) {
200         string temp = string(uri) + '?' + qstr;
201         setRequestURI(temp.c_str());
202     }
203     else {
204         setRequestURI(uri);
205     }
206
207     // See if this is the first time we've run.
208     if (!g_spoofKey.empty()) {
209         qstr = pblock_findval("Shib-Spoof-Check", rq->headers);
210         if (qstr && g_spoofKey == qstr)
211             m_firsttime = false;
212     }
213     if (!m_firsttime || rq->orig_rq)
214         log(SPDebug, "nsapi_shib function running more than once");
215   }
216   ~ShibTargetNSAPI() { }
217
218   const char* getScheme() const {
219     return security_active ? "https" : "http";
220   }
221   const char* getHostname() const {
222 #ifdef vs_is_default_vs
223     // This is 6.0 or later, so we can distinguish requests to name-based vhosts.
224     if (!vs_is_default_vs(request_get_vs(m_rq)))
225         // The beauty here is, a non-default vhost can *only* be accessed if the client
226         // specified the exact name in the Host header. So we can trust the Host header.
227         return pblock_findval("host", m_rq->headers);
228     else
229 #endif
230     // In other cases, we're going to rely on the initialization process...
231     return g_ServerName.c_str();
232   }
233   int getPort() const {
234     return server_portnum;
235   }
236   const char* getMethod() const {
237     return pblock_findval("method", m_rq->reqpb);
238   }
239   string getContentType() const {
240     char* content_type = NULL;
241     if (request_header("content-type", &content_type, m_sn, m_rq) != REQ_PROCEED)
242         return "";
243     return content_type ? content_type : "";
244   }
245   long getContentLength() const {
246     if (m_gotBody)
247         return m_body.length();
248     char* content_length=NULL;
249     if (request_header("content-length", &content_length, m_sn, m_rq) != REQ_PROCEED)
250         return 0;
251     return content_length ? atoi(content_length) : 0;
252   }
253   string getRemoteAddr() const {
254     string ret = AbstractSPRequest::getRemoteAddr();
255     return ret.empty() ? pblock_findval("ip", m_sn->client) : ret;
256   }
257   void log(SPLogLevel level, const string& msg) const {
258     AbstractSPRequest::log(level,msg);
259     if (level>=SPError)
260         log_error(LOG_FAILURE, "nsapi_shib", m_sn, m_rq, const_cast<char*>(msg.c_str()));
261   }
262   const char* getQueryString() const {
263     return pblock_findval("query", m_rq->reqpb);
264   }
265   const char* getRequestBody() const {
266     if (m_gotBody)
267         return m_body.c_str();
268     char* content_length=NULL;
269     if (request_header("content-length", &content_length, m_sn, m_rq) != REQ_PROCEED || !content_length) {
270         m_gotBody = true;
271         return NULL;
272     }
273     else if (atoi(content_length) > 1024*1024) // 1MB?
274       throw opensaml::SecurityPolicyException("Blocked request body exceeding 1M size limit.");
275     else {
276       char ch=IO_EOF+1;
277       int cl=atoi(content_length);
278       m_gotBody=true;
279       while (cl && ch != IO_EOF) {
280         ch=netbuf_getc(m_sn->inbuf);
281         // Check for error.
282         if(ch==IO_ERROR)
283           break;
284         m_body += ch;
285         cl--;
286       }
287       if (cl)
288         throw IOException("Error reading request body from browser.");
289       return m_body.c_str();
290     }
291   }
292   void clearHeader(const char* rawname, const char* cginame) {
293     if (g_checkSpoofing && m_firsttime && !m_rq->orig_rq) {
294         if (m_allhttp.empty()) {
295             // Populate the set of client-supplied headers for spoof checking.
296             const pb_entry* entry;
297             for (int i=0; i<m_rq->headers->hsize; ++i) {
298                 entry = m_rq->headers->ht[i];
299                 while (entry) {
300                     string cgiversion("HTTP_");
301                     const char* pch = entry->param->name;
302                     while (*pch) {
303                         cgiversion += (isalnum(*pch) ? toupper(*pch) : '_');
304                         pch++;
305                     }
306                     m_allhttp.insert(cgiversion);
307                     entry = entry->next;
308                 }
309             }
310         }
311         if (m_allhttp.count(cginame) > 0)
312             throw opensaml::SecurityPolicyException("Attempt to spoof header ($1) was detected.", params(1, rawname));
313     }
314     if (strcmp(rawname, "REMOTE_USER") == 0) {
315         param_free(pblock_remove("remote-user", m_rq->headers));
316         pblock_nvinsert("remote-user", g_unsetHeaderValue.c_str(), m_rq->headers);
317     }
318     else {
319         param_free(pblock_remove(rawname, m_rq->headers));
320         pblock_nvinsert(rawname, g_unsetHeaderValue.c_str(), m_rq->headers);
321     }
322   }
323   void setHeader(const char* name, const char* value) {
324     param_free(pblock_remove(name, m_rq->headers));
325     pblock_nvinsert(name, value, m_rq->headers);
326   }
327   string getHeader(const char* name) const {
328     // NSAPI headers tend to be lower case. We'll special case "cookie" since it's used a lot.
329     char* hdr = NULL;
330     int cookie = strcmp(name, "Cookie");
331     if (cookie == 0)
332         name = "cookie";
333     if (request_header(const_cast<char*>(name), &hdr, m_sn, m_rq) != REQ_PROCEED) {
334       // We didn't get a hit, so we'll try a lower-casing operation, unless we already did...
335       if (cookie == 0)
336           return "";
337       string n;
338       while (*name)
339           n += tolower(*(name++));
340       if (request_header(const_cast<char*>(n.c_str()), &hdr, m_sn, m_rq) != REQ_PROCEED)
341           return "";
342     }
343     return string(hdr ? hdr : "");
344   }
345   void setRemoteUser(const char* user) {
346     pblock_nvinsert("auth-user", user, m_rq->vars);
347     param_free(pblock_remove("remote-user", m_rq->headers));
348     pblock_nvinsert("remote-user", user, m_rq->headers);
349   }
350   string getRemoteUser() const {
351     const char* ru = pblock_findval("auth-user", m_rq->vars);
352     return ru ? ru : "";
353   }
354   void setResponseHeader(const char* name, const char* value) {
355     pblock_nvinsert(name, value, m_rq->srvhdrs);
356   }
357
358   long sendResponse(istream& in, long status) {
359     string msg;
360     char buf[1024];
361     while (in) {
362         in.read(buf,1024);
363         msg.append(buf,in.gcount());
364     }
365     pblock_nvinsert("connection","close",m_rq->srvhdrs);
366     pblock_nninsert("content-length", msg.length(), m_rq->srvhdrs);
367     protocol_status(m_sn, m_rq, status, NULL);
368     protocol_start_response(m_sn, m_rq);
369     net_write(m_sn->csd,const_cast<char*>(msg.c_str()),msg.length());
370     return REQ_EXIT;
371   }
372   long sendRedirect(const char* url) {
373     param_free(pblock_remove("content-type", m_rq->srvhdrs));
374     pblock_nninsert("content-length", 0, m_rq->srvhdrs);
375     pblock_nvinsert("expires", "01-Jan-1997 12:00:00 GMT", m_rq->srvhdrs);
376     pblock_nvinsert("cache-control", "private,no-store,no-cache", m_rq->srvhdrs);
377     pblock_nvinsert("location", url, m_rq->srvhdrs);
378     pblock_nvinsert("connection","close",m_rq->srvhdrs);
379     protocol_status(m_sn, m_rq, PROTOCOL_REDIRECT, NULL);
380     protocol_start_response(m_sn, m_rq);
381     return REQ_ABORTED;
382   }
383   long returnDecline() { return REQ_NOACTION; }
384   long returnOK() { return REQ_PROCEED; }
385   const vector<string>& getClientCertificates() const {
386       if (m_certs.empty()) {
387           const char* cert = pblock_findval("auth-cert", m_rq->vars);
388           if (cert)
389               m_certs.push_back(cert);
390       }
391       return m_certs;
392   }
393 };
394
395 /********************************************************************************/
396
397 int WriteClientError(::Session* sn, Request* rq, char* func, char* msg)
398 {
399     log_error(LOG_FAILURE,func,sn,rq,msg);
400     protocol_status(sn,rq,PROTOCOL_SERVER_ERROR,msg);
401     return REQ_ABORTED;
402 }
403
404 #undef FUNC
405 #define FUNC "shibboleth"
406 extern "C" NSAPI_PUBLIC int nsapi_shib(pblock* pb, ::Session* sn, Request* rq)
407 {
408   ostringstream threadid;
409   threadid << "[" << getpid() << "] nsapi_shib" << '\0';
410   xmltooling::NDC ndc(threadid.str().c_str());
411
412   try {
413     ShibTargetNSAPI stn(pb, sn, rq);
414
415     // Check user authentication
416     pair<bool,long> res = stn.getServiceProvider().doAuthentication(stn);
417     // If directed, install a spoof key to recognize when we've already cleared headers.
418     if (!g_spoofKey.empty()) {
419       param_free(pblock_remove("Shib-Spoof-Check", rq->headers));
420       pblock_nvinsert("Shib-Spoof-Check", g_spoofKey.c_str(), rq->headers);
421     }
422     if (res.first) return (int)res.second;
423
424     // user authN was okay -- export the assertions now
425     param_free(pblock_remove("auth-user",rq->vars));
426
427     // This seems to be required in order to eventually set
428     // the auth-user var.
429     pblock_nvinsert("auth-type","shibboleth",rq->vars);
430
431     res = stn.getServiceProvider().doExport(stn);
432     if (res.first) return (int)res.second;
433
434     // Check the Authorization
435     res = stn.getServiceProvider().doAuthorization(stn);
436     if (res.first) return (int)res.second;
437
438     // this user is ok.
439     return REQ_PROCEED;
440   }
441   catch (exception& e) {
442     log_error(LOG_FAILURE,FUNC,sn,rq,const_cast<char*>(e.what()));
443     return WriteClientError(sn, rq, FUNC, "Shibboleth module threw an exception, see web server log for error.");
444   }
445   catch (...) {
446     log_error(LOG_FAILURE,FUNC,sn,rq,const_cast<char*>("Shibboleth module threw an unknown exception."));
447     if (g_catchAll)
448         return WriteClientError(sn, rq, FUNC, "Shibboleth module threw an unknown exception.");
449     throw;
450   }
451 }
452
453
454 #undef FUNC
455 #define FUNC "shib_handler"
456 extern "C" NSAPI_PUBLIC int shib_handler(pblock* pb, ::Session* sn, Request* rq)
457 {
458   ostringstream threadid;
459   threadid << "[" << getpid() << "] shib_handler" << '\0';
460   xmltooling::NDC ndc(threadid.str().c_str());
461
462   try {
463     ShibTargetNSAPI stn(pb, sn, rq);
464
465     pair<bool,long> res = stn.getServiceProvider().doHandler(stn);
466     if (res.first) return (int)res.second;
467
468     return WriteClientError(sn, rq, FUNC, "Shibboleth handler did not do anything.");
469   }
470   catch (exception& e) {
471     log_error(LOG_FAILURE,FUNC,sn,rq,const_cast<char*>(e.what()));
472     return WriteClientError(sn, rq, FUNC, "Shibboleth handler threw an exception, see web server log for error.");
473   }
474   catch (...) {
475     log_error(LOG_FAILURE,FUNC,sn,rq,"unknown exception caught in Shibboleth handler");
476     if (g_catchAll)
477         return WriteClientError(sn, rq, FUNC, "Shibboleth handler threw an unknown exception.");
478     throw;
479   }
480 }
481
482
483 class SunRequestMapper : public virtual RequestMapper, public virtual PropertySet
484 {
485 public:
486     SunRequestMapper(const xercesc::DOMElement* e);
487     ~SunRequestMapper() { delete m_mapper; delete m_stKey; delete m_propsKey; }
488     Lockable* lock() { return m_mapper->lock(); }
489     void unlock() { m_stKey->setData(NULL); m_propsKey->setData(NULL); m_mapper->unlock(); }
490     Settings getSettings(const HTTPRequest& request) const;
491
492     const PropertySet* getParent() const { return NULL; }
493     void setParent(const PropertySet*) {}
494     pair<bool,bool> getBool(const char* name, const char* ns=NULL) const;
495     pair<bool,const char*> getString(const char* name, const char* ns=NULL) const;
496     pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const;
497     pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=NULL) const;
498     pair<bool,int> getInt(const char* name, const char* ns=NULL) const;
499     void getAll(map<string,const char*>& properties) const;
500     const PropertySet* getPropertySet(const char* name, const char* ns=shibspconstants::ASCII_SHIB2SPCONFIG_NS) const;
501     const xercesc::DOMElement* getElement() const;
502
503 private:
504     RequestMapper* m_mapper;
505     ThreadKey* m_stKey;
506     ThreadKey* m_propsKey;
507 };
508
509 RequestMapper* SunRequestMapFactory(const xercesc::DOMElement* const & e)
510 {
511     return new SunRequestMapper(e);
512 }
513
514 SunRequestMapper::SunRequestMapper(const xercesc::DOMElement* e) : m_mapper(NULL), m_stKey(NULL), m_propsKey(NULL)
515 {
516     m_mapper = SPConfig::getConfig().RequestMapperManager.newPlugin(XML_REQUEST_MAPPER,e);
517     m_stKey=ThreadKey::create(NULL);
518     m_propsKey=ThreadKey::create(NULL);
519 }
520
521 RequestMapper::Settings SunRequestMapper::getSettings(const HTTPRequest& request) const
522 {
523     Settings s=m_mapper->getSettings(request);
524     m_stKey->setData((void*)dynamic_cast<const ShibTargetNSAPI*>(&request));
525     m_propsKey->setData((void*)s.first);
526     return pair<const PropertySet*,AccessControl*>(this,s.second);
527 }
528
529 pair<bool,bool> SunRequestMapper::getBool(const char* name, const char* ns) const
530 {
531     const ShibTargetNSAPI* stn=reinterpret_cast<const ShibTargetNSAPI*>(m_stKey->getData());
532     const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
533     if (stn && !ns && name) {
534         // Override boolean properties.
535         const char* param=pblock_findval(name,stn->m_pb);
536         if (param && (!strcmp(param,"1") || !strcasecmp(param,"true")))
537             return make_pair(true,true);
538     }
539     return s ? s->getBool(name,ns) : make_pair(false,false);
540 }
541
542 pair<bool,const char*> SunRequestMapper::getString(const char* name, const char* ns) const
543 {
544     const ShibTargetNSAPI* stn=reinterpret_cast<const ShibTargetNSAPI*>(m_stKey->getData());
545     const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
546     if (stn && !ns && name) {
547         // Override string properties.
548         if (!strcmp(name,"authType"))
549             return pair<bool,const char*>(true,"shibboleth");
550         else {
551             const char* param=pblock_findval(name,stn->m_pb);
552             if (param)
553                 return make_pair(true,param);
554         }
555     }
556     return s ? s->getString(name,ns) : pair<bool,const char*>(false,NULL);
557 }
558
559 pair<bool,const XMLCh*> SunRequestMapper::getXMLString(const char* name, const char* ns) const
560 {
561     const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
562     return s ? s->getXMLString(name,ns) : pair<bool,const XMLCh*>(false,NULL);
563 }
564
565 pair<bool,unsigned int> SunRequestMapper::getUnsignedInt(const char* name, const char* ns) const
566 {
567     const ShibTargetNSAPI* stn=reinterpret_cast<const ShibTargetNSAPI*>(m_stKey->getData());
568     const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
569     if (stn && !ns && name) {
570         // Override int properties.
571         const char* param=pblock_findval(name,stn->m_pb);
572         if (param)
573             return pair<bool,unsigned int>(true,strtol(param,NULL,10));
574     }
575     return s ? s->getUnsignedInt(name,ns) : pair<bool,unsigned int>(false,0);
576 }
577
578 pair<bool,int> SunRequestMapper::getInt(const char* name, const char* ns) const
579 {
580     const ShibTargetNSAPI* stn=reinterpret_cast<const ShibTargetNSAPI*>(m_stKey->getData());
581     const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
582     if (stn && !ns && name) {
583         // Override int properties.
584         const char* param=pblock_findval(name,stn->m_pb);
585         if (param)
586             return pair<bool,int>(true,atoi(param));
587     }
588     return s ? s->getInt(name,ns) : pair<bool,int>(false,0);
589 }
590
591 void SunRequestMapper::getAll(map<string,const char*>& properties) const
592 {
593     const ShibTargetNSAPI* stn=reinterpret_cast<const ShibTargetNSAPI*>(m_stKey->getData());
594     const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
595     if (s)
596         s->getAll(properties);
597     if (!stn)
598         return;
599     properties["authType"] = "shibboleth";
600     const pb_entry* entry;
601     for (int i=0; i<stn->m_pb->hsize; ++i) {
602         entry = stn->m_pb->ht[i];
603         while (entry) {
604             properties[entry->param->name] = entry->param->value;
605             entry = entry->next;
606         }
607     }
608 }
609
610 const PropertySet* SunRequestMapper::getPropertySet(const char* name, const char* ns) const
611 {
612     const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
613     return s ? s->getPropertySet(name,ns) : NULL;
614 }
615
616 const xercesc::DOMElement* SunRequestMapper::getElement() const
617 {
618     const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
619     return s ? s->getElement() : NULL;
620 }