有人在qq游戏头像里像我寻求帮助怎么办

PHP修改LDAP用户密码程序
&!DOCTYPE html PUBLIC &-//W3C//DTD XHTML 1.0 Strict//EN&
&&& &http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&&
&html xmlns=&http://www.w3.org/1999/xhtml& xml:lang=&en& lang=&en&&
&title& Reset LDAP Password&/title&
&style type=&text/css&&
&&& font-weight:
===========================================================&&&
&&& ldap.php&&& Zhu Weiwei
&&& Copyright &
China. All Rights Reserved.
===========================================================
$u&& = $_REQUEST['u'];
$op& = $_REQUEST['op'];
$np1 = $_REQUEST['np1'];
$np2 = $_REQUEST['np2'];
$an& = $_REQUEST['an'];
if(!empty($an)){
&&& if( empty($u) or empty($op) or empty($np1) or empty($np2) ){
&&&&&&& $msg = &Some filed was empty!&;
&&& }else{
&&&&&&& if( $np1 != $np2& ){
&&&&&&&&&&& $msg = &confirm password error!&;
&&&&&&& }else{
&&&&&&&&&&& if($op == $np1){
&&&&&&&&&&&&&& $msg = &new password can not be same as old password!&;
&&&&&&&&&&& }else{
&&&&&&&&&&&&&&& $ldap_host = &&;
&&&&&&&&&&&&&&& $ldap_port = 389;
&&&&&&&&&&&&&&& $base_dn&& = &dc=domain,dc=com&;
&&&&&&&&&&&&&&& $connect = @ldap_connect( $ldap_host, $ldap_port);
&&&&&&&&&&&&&&& if(!$connect){
&&&&&&&&&&&&&&&&&&& $msg = &Could not connect to LDAP server&;
&&&&&&&&&&&&&&& }else{
&&&&&&&&&&&&&&&&&&& $user_dn&& = sprintf(&uid=%s,ou=Staff,dc=domain,dc=com&,$u);
&&&&&&&&&&&&&&&&&&& $user_pass = $
&&&&&&&&&&&&&&&&&&& $bind = @ldap_bind($connect, $user_dn, $user_pass);
&&&&& &&&&&&&&&&&&&&if(!$bind){
&&&&&&&&&&&&&&&&&&&&&&& $msg = &old password error!&;
&&&&&&&&&&&&&&&&&&& }else{
&&&&&&&&&&&&&&&&&&&&&&& $root_dn&& = &cn=Manager,dc=domain,dc=com&;
&&&&&&&&&&&&&&&&&&&&&&& $root_pass = 'noPa$$w0rd#';
&&&&&&&&&&&&&&&&&&&&&&& $bind = @ldap_bind($connect, $root_dn, $root_pass);
&&&&&&&&&&&&&&&&&&&&&&& if(!$bind){
&&&&&&&&&&&&&&&&&&&&&&&&&&& $msg = &Programe can not bind to LDAP server!&;
&&&&&&&&&&&&&&&&&&&&&&& }else{
&&&&&&&&&&&&&&&&&&&&&&&&&&& $values[&userPassword&][0] = &{md5}&.base64_encode(pack(&H*&,md5($np1)));
&&&&&&&&&&&&&&&&&&&&&&&&&&& $rs = @ldap_mod_replace($connect,$user_dn,$values);
&&&&&&&&&&&&&&&&&&&&&&&&&&& if($rs){
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& $msg = &password modifed success!&;
&&&&&&&&&&&&&&&&&&&&&&&&&&& }else{
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& $msg = &password modifed failed!&;
&&&&&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& @ldap_close($connect);
&&&&&&&&&&& }
if(!empty($msg)){
&&& print(&&h1&$msg&/h1&&);
&form method=&post& action=&&&
&&& &dt&User Id&/dt&
&&& &dd&uid=&input type=&text& name=&u& size=&16& /&,ou=Staff,dc=domain,dc=cn&/dd&
&&& &dt&Old Password&/dt&
&&& &dd&&input type=&text& name=&op& /&&/dd&
&&& &dt&New Password&/dt&
&&& &dd&&input type=&text& name=&np1& /&&/dd&
&&& &dt&Confirm Password&/dt&
&&& &dd&&input type=&text& name=&np2& /&&/dd&
&&& &dd&&input type=&submit& value=&Submit& /&&/dd&
& &input type=&hidden& name=&an& value=&submit& /&
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467142',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'新手园地& & & 硬件问题Linux系统管理Linux网络问题Linux环境编程Linux桌面系统国产LinuxBSD& & & BSD文档中心AIX& & & 新手入门& & & AIX文档中心& & & 资源下载& & & Power高级应用& & & IBM存储AS400Solaris& & & Solaris文档中心HP-UX& & & HP文档中心SCO UNIX& & & SCO文档中心互操作专区IRIXTru64 UNIXMac OS X门户网站运维集群和高可用服务器应用监控和防护虚拟化技术架构设计行业应用和管理服务器及硬件技术& & & 服务器资源下载云计算& & & 云计算文档中心& & & 云计算业界& & & 云计算资源下载存储备份& & & 存储文档中心& & & 存储业界& & & 存储资源下载& & & Symantec技术交流区安全技术网络技术& & & 网络技术文档中心C/C++& & & GUI编程& & & Functional编程内核源码& & & 内核问题移动开发& & & 移动开发技术资料ShellPerlJava& & & Java文档中心PHP& & & php文档中心Python& & & Python文档中心RubyCPU与编译器嵌入式开发驱动开发Web开发VoIP开发技术MySQL& & & MySQL文档中心SybaseOraclePostgreSQLDB2Informix数据仓库与数据挖掘NoSQL技术IT业界新闻与评论IT职业生涯& & & 猎头招聘IT图书与评论& & & CU技术图书大系& & & Linux书友会二手交易下载共享Linux文档专区IT培训与认证& & & 培训交流& & & 认证培训清茶斋投资理财运动地带快乐数码摄影& & & 摄影器材& & & 摄影比赛专区IT爱车族旅游天下站务交流版主会议室博客SNS站务交流区CU活动专区& & & Power活动专区& & & 拍卖交流区频道交流区
丰衣足食, 积分 732, 距离下一级还需 268 积分
论坛徽章:0
可能是我了解得不足,unix下passwd只能手动输入密码来修改,不能自动化这个过程。。。
/home/cpfly/& passwd
Changing password for &cpfly&
cpfly's Old password:
这个时候输入的密码没有回显,但是确实输入进去了,敲入回车就可以判断密码是否正确,然后更改密码。。
我想实现这个地方的输入由程序来输入,大体想法是:
1. 定义一个文件操作符,可读可写,非阻塞
2. fork() 子进程重定义 标准输入,close(0), dup(fd), close(fd)... 然后execl(&/bin/passwd&,&passwd&,(char *)0);
3. 父进程写那个文件,就相当于写入 子进程的标准输入里。。。
失败了,请教该如何做,或者有更好的办法,谢谢。。
&&nbsp|&&nbsp&&nbsp|&&nbsp&&nbsp|&&nbsp&&nbsp|&&nbsp
论坛徽章:1
呵呵,又是一个光凭想象的。
你打开 passwd.c 看一下,就知道你那个方法肯定是不管用的了——是谁告诉你 passwd 读的是 stdin/fd0 的了?
丰衣足食, 积分 949, 距离下一级还需 51 积分
论坛徽章:0
家境小康, 积分 1133, 距离下一级还需 867 积分
论坛徽章:0
曾经尝试用shell实现这个问题,但还是需要人工交互。
牛人给个解决方案吧
丰衣足食, 积分 859, 距离下一级还需 141 积分
论坛徽章:0
expect !!! 去看看这个脚本语言吧! 它是支持交互式的!!
可以在bash 里内嵌的!
小富即安, 积分 2511, 距离下一级还需 2489 积分
论坛徽章:0
参考 busybox 原码 loginutils/passwd.c ,比较简洁。
小富即安, 积分 2219, 距离下一级还需 2781 积分
论坛徽章:0
struct passwd {
& & & & char& & & & *pw_& & & & & & & & /* user name */
& & & & char& & & & *pw_& & & & & & & & /* encrypted password */
& & & & uid_t& & & & pw_& & & & & & & & & & & & /* user uid */
& & & & gid_t& & & & pw_& & & & & & & & & & & & /* user gid */
& & & & time_t& & & & pw_& & & & & & & & /* password change time */
& & & & char& & & & *pw_& & & & & & & & /* user access class */
& & & & char& & & & *pw_& & & & & & & & /* Honeywell login info */
& & & & char& & & & *pw_& & & & & & & & /* home directory */
& & & & char& & & & *pw_& & & & & & & & /* default shell */
& & & & time_t& & & & pw_& & & & & & & & /* account expiration */
& & & & int& & & & pw_& & & & & & & & /* internal: fields filled in */
看你需要实现的自动化的程度
小富即安, 积分 2423, 距离下一级还需 2577 积分
论坛徽章:0
回复 1楼 cpfly 的帖子
自己写用户帐号等信息到系统就行了,生成密码替换原密码即可
[ 本帖最后由 chzht001 于
14:43 编辑 ]
丰衣足食, 积分 732, 距离下一级还需 268 积分
论坛徽章:0
谢谢大家,我一个一个回复吧,看看我的理解正确吗:
谢谢你的点醒...
/home/cpfly/& chpasswd
ksh: chpasswd:&&not found.
aple_smx (Bowe) :
要是可以自己实现一个shell,passwd在这个shell里面用,不知道可不可以,看来还要读一下passwd.c
新手上路2世:
/home/cpfly/& ls -l /usr/bin/expect
The file /usr/bin/expect does not exist.
connet (help u & me):
找到bb_askpass(), 它重新定义了terminal的属性,不管我开始怎么重定义,它都会改成它的。。。
& & & & new.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY);
& & & & new.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP);
& & & & tcsetattr(STDIN_FILENO, TCSANOW, &new);
尽管我可以调用系统函数得到这些变量,可以怎么设置呢。。
那样参考源码是怎么写的,最后落实的时候,我没有足够的权限,没有办法写/etc/passwd, shadow这类的文件
[ 本帖最后由 cpfly 于
16:13 编辑 ]
丰衣足食, 积分 949, 距离下一级还需 51 积分
论坛徽章:0
& && & chpasswd - update password file in batch
& && & chpasswd [-e]
DESCRIPTION
& && & chpasswd& & & &&&reads& & & & a&&file& & & &&&of user name and password pairs from standard
& && & input and uses this information to update a group&&of&&existing& & & & users.
& && & Without the -e switch, the passwords are expected to be cleartext. With
& && & the -e switch, the passwords are expected&&to&&be&&in&&encrypted& & & &&&form.
& && & Each line is of the format
& & & && && & user_name:password
& && & The&&named user must exist.&&The supplied password will be encrypted as
& && & necessary, and the password age updated, if present.
& && & This command is intended to be used in a large system environment where
& && & many accounts are created at a single time.
& && & The&&input file must be protected if it contains unencrypted passwords.
& && & passwd(1), newusers(, useradd(
& && & Julianne Frances Haugh ()
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & && & CHPASSWD(
我装的debian,装完基本系统就有这个命令了
北京皓辰网域网络信息技术有限公司. 版权所有 京ICP证:060528号 北京市公安局海淀分局网监中心备案编号:
广播电视节目制作经营许可证(京) 字第1234号
中国互联网协会会员&&联系我们:
感谢所有关心和支持过ChinaUnix的朋友们
转载本站内容请注明原作者名及出处

我要回帖

更多关于 qq游戏大厅头像怎么改 的文章

 

随机推荐