Browse CVS Repository
Diff of /xoonips/AL/xnpal.cc
Parent Directory
| Revision Log
| Revision Graph
| Patch
| 553 |
RETURN_NULL(); |
RETURN_NULL(); |
| 554 |
} |
} |
| 555 |
|
|
| 556 |
// int vp_create_session( string xoops_sess_id, int uid, string remoteHost ) |
// int vp_create_session( string xoops_sess_id, int uid ) |
| 557 |
ZEND_FUNCTION(vp_create_session) |
ZEND_FUNCTION(vp_create_session) |
| 558 |
{ |
{ |
| 559 |
char *xoopsSessionID; |
char *xoopsSessionID; |
| 560 |
int xoopsSessionIDLen; |
int xoopsSessionIDLen; |
| 561 |
long sid, uid; |
long sid, uid; |
| 562 |
|
|
| 563 |
long lRemoteHost; |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", |
| 564 |
char *pcRemoteHost; |
&xoopsSessionID, &xoopsSessionIDLen, &uid) == FAILURE) { |
|
int cbRemoteHost; |
|
|
struct in_addr inRemoteHost; |
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sls", |
|
|
&xoopsSessionID, &xoopsSessionIDLen, &uid, |
|
|
&pcRemoteHost, &cbRemoteHost) == FAILURE) { |
|
| 565 |
return; |
return; |
| 566 |
} |
} |
| 567 |
|
|
|
// "1.2.3.4" -> 0x01020304変換。不正な文字列なら0とみなす。ipv6未対応 |
|
|
string strRemoteHost( pcRemoteHost, cbRemoteHost ); |
|
|
if ( inet_aton( strRemoteHost.c_str(), &inRemoteHost ) != 0 ) |
|
|
memcpy( &lRemoteHost, &inRemoteHost, 4 ); |
|
|
else |
|
|
lRemoteHost = 0; |
|
|
|
|
|
string strXoopsSessionID( xoopsSessionID, xoopsSessionIDLen ); |
|
| 568 |
sessionid_t vpsid; |
sessionid_t vpsid; |
| 569 |
result_t result = createSession( strXoopsSessionID.c_str(), (sessionid_t)sid, (userid_t)uid, &vpsid ); |
result_t result = createSession( xoopsSessionID, (sessionid_t)sid, &vpsid ); |
| 570 |
|
|
| 571 |
RETURN_LONG((long)vpsid); |
RETURN_LONG((long)vpsid); |
| 572 |
} |
} |
|
|
Legend:
| Removed from v.1.2 |
|
| changed lines |
| |
Added in v.1.3 |
|
|
| |