2008-12-09 64 views

回答

1

使用passwd shell命令。

+0

不密碼塊重定向輸入?如果沒有,你可以這樣做,但是你必須把所有三行寫到一個文件(原始的,新的,新的),然後重定向它,但我認爲這不應該工作(爲了安全) 。可能是錯的。 – 2008-12-09 18:39:12

1

蘋果推出Mac OS中10.5 CSIdentitySetPassword API,允許更改密碼,如下所示:

#import <Collaboration/Collaboration.h> 

    AuthorizationRef authRef = NULL; // You have to initialize authRef 

    CBIdentityAuthority *authority = [CBIdentityAuthority defaultIdentityAuthority]; 
    CSIdentityRef identity = [CBIdentity identityWithName:user authority:authority].CSIdentity; 
    if (CSIdentityGetClass(identity) == kCSIdentityClassUser) { 
     CSIdentitySetPassword(identity, (__bridge CFStringRef)newPassword); 
     CSIdentityCommit(identity, authRef, NULL); 
    } 

AuthenticationRef可以如int this響應進行初始化。

相關問題