<br><br style="font-weight: bold;"><div><span style="font-weight: bold;" class="gmail_quote">On 11/7/05, <span class="gmail_sendername">Tino Wildenhain</span> &lt;<a href="mailto:tino@wildenhain.de">tino@wildenhain.de</a>&gt; wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><span style="font-weight: bold;">ajit mote schrieb:</span><br style="font-weight: bold;">
<span style="font-weight: bold;">&gt; this is what i tried ....</span><br style="font-weight: bold;"><span style="font-weight: bold;">&gt;</span><br style="font-weight: bold;"><span style="font-weight: bold;">&gt; #External script 
addUser.py (stored in instance/Extensions folder)</span><br style="font-weight: bold;"><span style="font-weight: bold;">&gt; import crypt</span><br style="font-weight: bold;"><span style="font-weight: bold;">&gt; import os
</span><br style="font-weight: bold;"><span style="font-weight: bold;">&gt; def addUser(userName,password):</span><br style="font-weight: bold;"><span style="font-weight: bold;">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; password=crypt.crypt(password,&quot;5Ag5zoM9&quot;)
</span><br style="font-weight: bold;"><span style="font-weight: bold;">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command=&quot;/usr/sbin/adduser -p &quot;+password+&quot; &quot;+ userName</span><br style="font-weight: bold;"><span style="font-weight: bold;">
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return os.system(command)</span><br style="font-weight: bold;"><span style="font-weight: bold;">&gt;</span><br style="font-weight: bold;"><br style="font-weight: bold;"><span style="font-weight: bold;">Heaven! Is this external method available via web? If so
</span><br style="font-weight: bold;"><span style="font-weight: bold;">be prepared for massive attack :-)</span><br style="font-weight: bold;"><span style="font-weight: bold;">That aside you may consider md5 instead of crypt to make
</span><br style="font-weight: bold;"><span style="font-weight: bold;">it not too easy to crack (otoh, its not really important</span><br style="font-weight: bold;"><span style="font-weight: bold;">as your script really allows for any command)
</span><br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; as we are going to use application only in intranet .....</blockquote><div>&nbsp;
&nbsp; &nbsp; &nbsp;&nbsp; we are developing this web application only
for our purpose ie. using only inside our firm....
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my sys admin allow me to do this ....<br>
</div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; so no security problem ....<br>
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex; font-weight: bold;">&gt; ///////////////<br>&gt;&nbsp;&nbsp;attaching the application ....<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exported from 
zope2.8.1 ,python-2.3.4-11,mysql-3.23.58-13 and<br>&gt; Linux&nbsp;&nbsp;2.6.9-1.667 ....<br>&gt; ////////////////////////<br>&gt; now i hope that , problem defination is very clear and open......<br>&gt; ///////////////////<br><br>
Well no, at least not your &quot;it does not work&quot; problem you told us.<br><br>Still missing: the call to the script as &quot;User which runs zope&quot;<br>which might be zope or nobody or something, depending on your
<br>configuration and the way you start zope.<br><br>Add the following lines to your external method and you can<br>run it as script too:<br><br>if __name__=='__main__':<br>&nbsp;&nbsp;&nbsp;&nbsp;import sys<br>&nbsp;&nbsp;&nbsp;&nbsp;try:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user=sys.argv
[1]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pass=sys.argv[2]<br>&nbsp;&nbsp;&nbsp;&nbsp;except IndexError:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sys.stderr.write(&quot;Please start me with %s &lt;username&gt;<br>&lt;password&gt;\n&quot; % sys.argv[0])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sys.exit(20)<br><br>&nbsp;&nbsp;&nbsp;&nbsp; addUser(user,pass)
<br><br><br><br>and try it like this:<br><br>su zope (or whoever your zope runs)<br>./yourmethod.py someuser somepass<br><br>You will see it fail (apart from the fact you need<br>the #!/path/to/python.bin and set the execution bit
<br>with chmod a+x before you try)</blockquote><div><br style="font-weight: bold;">
&nbsp;&gt; &nbsp; i tried using another user outside of zope .....<br>
&nbsp;&nbsp;&nbsp;&nbsp; working very well(adding user to system)....<br>
</div>&nbsp;&nbsp;&nbsp;&nbsp; owner of external method is root and set_user_id bit is set.....<br>
&nbsp;&nbsp;&nbsp;&nbsp; but problem is when i run attached app it is not adding user ....<br>
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex; font-weight: bold;">Because you did not use sudo as adviced.<br><br>Please try to copy the way mails are cited from other
<br>mails in this list. Dont put all your text on the<br>top of a full quote. Thank you.<br><br>Regards<br>Tino</blockquote><div><br>
&gt;&nbsp; &nbsp; i am really <span style="text-decoration: underline; font-style: italic; background-color: rgb(255, 204, 51);">sorry</span> for the same....<br>
<br>
&nbsp;&nbsp;&nbsp; <br>
</div><br></div><span style="font-weight: bold;">&nbsp;</span><br>
&nbsp;&nbsp;&nbsp; <br>