why you do not try to swauth? it's create enough i think...<br><br><div class="gmail_quote">On Tue, Dec 6, 2011 at 7:10 PM, crayon_z <span dir="ltr"><<a href="mailto:crayon.zxs@gmail.com">crayon.zxs@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><u></u>





<div style="MARGIN:10px">
<div>Hi, pf shineyear. </div>
<div> </div>
<div>It seems that you use swauth or tempauth as the auth system for Swift. Have 
you tried the keystone auth system? How to make a container private with 
keystone auth system? It seems that all the containers created are public.</div>
<div> </div>
<div>Thanks.</div>
<div> </div>
<hr style="WIDTH:210px;min-height:1px" align="left" color="#b5c4df" size="1">

<div><span><span>Crayon</span></span></div>
<div> </div>
<div style="BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0cm;PADDING-LEFT:0cm;PADDING-RIGHT:0cm;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">
<div style="PADDING-BOTTOM:8px;PADDING-LEFT:8px;PADDING-RIGHT:8px;BACKGROUND:#efefef;COLOR:#000000;FONT-SIZE:12px;PADDING-TOP:8px">
<div><b>Sender:</b> <a href="mailto:shinepf@gmail.com" target="_blank">pf 
shineyear</a></div>
<div><b>Date:</b> 2011年11月23日(星期三) 下午12:47</div>
<div><b>To:</b> <a href="mailto:openstack@lists.launchpad.net" target="_blank">openstack</a></div>
<div><b>Subject:</b> [Openstack] use php to make container public or 
not</div></div></div><div><div></div><div class="h5">
<div>
<div>
<div>php curl have a shit feature: can not post an empty http header, so if you 
want to perform a command like this in php:</div>
<div><br></div>
<div>swift -A <a href="http://10.38.10.127:8080/auth/v1.0" target="_blank">http://10.38.10.127:8080/auth/v1.0</a> 
-U AUTH_testa27:AUTH_testu27 -K testp post <font color="#ff0000">-r ' '</font> mycontainer2</div>
<div><br></div>
<div>the "X-Container-Read" will not be send, so you can not make a container 
unpublic from public</div>
<div><br></div>
<div>i write an example code to show how make it work with php, just use ' not " 
and plus \n at the end</div>
<div><br></div>
<div>hope can make some help</div>
<div><br></div>
<div><br></div>
<div><?php</div>
<div><br></div>
<div>    $prefix = "AUTH_";</div>
<div>    $account_name = $prefix."testa27";</div>
<div>    $user_name = $prefix."testu27";</div>
<div>    $user_pass = "testp";</div>
<div>    $container = "mycontainer2";</div>
<div>    $user_token = 
"AUTH_tkb21f5fcfea144cf9a99ed1de9a577db2";</div>
<div>    $path = "/v1/".$account_name."/".$container;</div>
<div><br></div>
<div><br></div>
<div>    #if you want to make container public use this</div>
<div>    #$http_headers = array("X-Auth-Token: ".$user_token, 
'X-Container-Read: .r:*');</div>
<div><br></div>
<div>    #if you want to make container not public use this</div>
<div>    $http_headers = array("X-Auth-Token: ".$user_token, 
'X-Container-Read: \n');</div>
<div><br></div>
<div>    print_r($http_header);</div>
<div><br></div>
<div>    $ch = curl_init();</div>
<div><br></div>
<div>    curl_setopt($ch, CURLOPT_URL, "<a href="http://10.38.10.127:8080" target="_blank">http://10.38.10.127:8080</a>".$path);</div>
<div>    curl_setopt($ch, CURLOPT_POST, 1);</div>
<div>    curl_setopt($ch, CURLOPT_HTTPHEADER, $http_headers);</div>
<div>    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);</div>
<div>    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);</div>
<div>    curl_setopt($ch, CURLINFO_HEADER_OUT, true);</div>
<div><br></div>
<div>    print "test set container public\n";</div>
<div><br></div>
<div>    curl_exec($ch);</div>
<div><br></div>
<div>    $headers = curl_getinfo($ch, CURLINFO_HEADER_OUT);</div>
<div><br></div>
<div>    print_r($headers);</div>
<div><br></div>
<div>    if (!curl_errno($ch))</div>
<div>    {</div>
<div>        $info = curl_getinfo($ch);</div>
<div><br></div>
<div>        if ((int)($info['http_code'] / 100) != 2)</div>
<div>        {</div>
<div>            print "set container public 
return error ".$info['http_code']."\n";</div>
<div>            return -1;</div>
<div>        }</div>
<div>    }</div>
<div>    else</div>
<div>    {</div>
<div>        print "set container public error\n";</div>
<div>        return -2;</div>
<div>    }</div>
<div><br></div>
<div>    curl_close($ch);</div>
<div><br></div>
<div>?></div></div></div></div></div></div>
</blockquote></div><br>