Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-04-2009, 07:57 AM
Junior Member
 
Posts: 7
Default Problem with New Zimbra Account Password (New Account with Zimbra SOAP service)

I'm writing a PHP programme in order to add account into zimbra using SOAP.
Every thing (I assume) get well but I can't log in with news accounts unless change their password in the administration interface.
I used a PHP function found earlier on this site.

look at my function :

PHP Code:
<?php
    
function ZimbraAdminCreateAccount($Trace$ServerAddress$AdminUserName$AdminPassword$NewUserName$NewPassword$NewUserFamilyName$NewUserSecondName$NewUserDisplayName$COSId)
{
        
$CurlHandle curl_init();
        
curl_setopt($CurlHandleCURLOPT_URL,           "https://$ServerAddress:7071/service/admin/soap");
        
curl_setopt($CurlHandleCURLOPT_POST,           TRUE);
        
curl_setopt($CurlHandleCURLOPT_RETURNTRANSFERTRUE);
        
curl_setopt($CurlHandleCURLOPT_SSL_VERIFYPEERFALSE);
        
curl_setopt($CurlHandleCURLOPT_SSL_VERIFYHOSTFALSE);

        
// ------ Send the zimbraAdmin AuthRequest -----

        
$SOAPMessage  '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
                                <soap:Header>
                                        <context xmlns="urn:zimbra"/>
                                </soap:Header>
                                <soap:Body>
                                        <AuthRequest xmlns="urn:zimbraAdmin">
                                                <name>' 
$AdminUserName '</name>
                                                <password>' 
$AdminPassword '</password>
                                        </AuthRequest>
                                </soap:Body>
                        </soap:Envelope>'
;

        
curl_setopt($CurlHandleCURLOPT_POSTFIELDS$SOAPMessage);

        if(!(
$ZimbraSOAPResponse curl_exec($CurlHandle)))
        {
                print(
"ERROR: curl_exec - (" curl_errno($CurlHandle) . ") " curl_error($CurlHandle));
                return(
FALSE);
        }

        
// print("Raw Zimbra SOAP Response:<BR>" . htmlentities($ZimbraSOAPResponse) . "<BR><BR>\n");

        // Parse for the sessionId
        // <sessionId type="admin" id="123">123</sessionId>
        
$sessionId strstr($ZimbraSOAPResponse"<sessionId");
        
$sessionId strstr($sessionId">");
        
$sessionId substr($sessionId1strpos($sessionId"<") - 1);
        
// print("sessionId = $sessionId<BR>\n");

        // Parse for the authToken
        // <authToken>123</authToken>
        
$authToken strstr($ZimbraSOAPResponse"<authToken");
        
$authToken strstr($authToken">");
        
$authToken substr($authToken1strpos($authToken"<") - 1);
        
// print("authToken = $authToken<BR>\n");


        // ------ Send the zimbraCreateAccount request -----
        
$SOAPMessage '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
                                <soap:Header>
                                        <context xmlns="urn:zimbra">
                                                <authToken>' 
$authToken '</authToken>
                                                <sessionId id="' 
$sessionId '">' $sessionId '</sessionId>
                                        </context>
                                </soap:Header>
                                <soap:Body>
                                        <CreateAccountRequest xmlns="urn:zimbraAdmin">
                                                <name>' 
$NewUserName '</name>
                                                <password>' 
$NewUserPassword '</password>
                                                <a n="zimbraCOSId">' 
$COSId '</a>
                                                <a n="gn">' 
$NewUserFamilyName '</a>
                                                <a n="sn">' 
$NewUserSecondName '</a>
                                                <a n="displayName">' 
$NewUserDisplayName '</a>
                                        </CreateAccountRequest>
                                </soap:Body>
                        </soap:Envelope>'
;

        
curl_setopt($CurlHandleCURLOPT_POSTFIELDS$SOAPMessage);

        if(!(
$ZimbraSOAPResponse curl_exec($CurlHandle)))
        {
                print(
"ERROR: curl_exec - (" curl_errno($CurlHandle) . ") " curl_error($CurlHandle));
                return(
FALSE);
        }

        
// print("Raw Zimbra SOAP Response:<BR>" . htmlentities($ZimbraSOAPResponse) . "<BR><BR>\n");

        
return($ZimbraSOAPResponse);
}
I supply the password in clair (without any encrypt).

Please, your help.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.