]> git.saurik.com Git - apple/system_cmds.git/blobdiff - chkpasswd.tproj/passwd.c
system_cmds-433.8.tar.gz
[apple/system_cmds.git] / chkpasswd.tproj / passwd.c
index ae9c0d9b8fb2d44689552dc550775fb6b197df46..ac50cd0dfa7e574e0ddda2cacd08b855d883f8be 100644 (file)
@@ -21,9 +21,9 @@
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
-#define INFO_NETINFO 0
 #define INFO_FILE 1
 #define INFO_NIS 2
+#define INFO_DIRECTORYSERVICES 3
 
 #ifndef __SLICK__
 #define _PASSWD_FILE "/etc/master.passwd"
@@ -38,7 +38,6 @@
 #include <ctype.h>
 #include <string.h>
 #include <pwd.h>
-#include <netinfo/ni.h>
 #include "stringops.h"
 
 #ifdef __SLICK__
@@ -48,8 +47,8 @@
 static int literal = 0;
 
 extern int file_check_passwd(char *, char *);
-extern int netinfo_check_passwd(char *, char *);
 extern int nis_check_passwd(char *, char *);
+extern int ds_check_passwd(char *, char *);
 
 void
 checkpasswd(char *name, char *old_pw)
@@ -82,13 +81,13 @@ usage()
 {
        fprintf(stderr, "usage: chkpasswd [-i infosystem] [-l location] [-c] [name]\n");
        fprintf(stderr, "supported infosystems are:\n");
-       fprintf(stderr, "    netinfo\n");
        fprintf(stderr, "    file\n");
        fprintf(stderr, "    nis\n");
-       fprintf(stderr, "for netinfo, location may be a domain name or server/tag\n");
+       fprintf(stderr, "    opendirectory\n");
        fprintf(stderr, "for file, location may be a file name (%s is the default)\n",
                _PASSWD_FILE);
        fprintf(stderr, "for nis, location may be a NIS domainname\n");
+       fprintf(stderr, "for opendirectory, location may be a directory node name\n");
        fprintf(stderr, "if -c is specified, the password you supply is compared\n");
        fprintf(stderr, "verbatim without first being crypted\n");
        exit(1);
@@ -101,7 +100,7 @@ main(int argc, char *argv[])
        int i, infosystem;
        struct passwd *pw;
 
-       infosystem = INFO_NETINFO;
+       infosystem = INFO_DIRECTORYSERVICES;
        user = NULL;
        locn = NULL;
 
@@ -115,14 +114,13 @@ main(int argc, char *argv[])
                                usage();
                        }
 
-                       if (!strcmp(argv[i], "NetInfo")) infosystem = INFO_NETINFO;
-                       else if (!strcmp(argv[i], "netinfo")) infosystem = INFO_NETINFO;
-                       else if (!strcmp(argv[i], "File")) infosystem = INFO_FILE;
+                       if (!strcmp(argv[i], "File")) infosystem = INFO_FILE;
                        else if (!strcmp(argv[i], "file")) infosystem = INFO_FILE;
                        else if (!strcmp(argv[i], "NIS")) infosystem = INFO_NIS;
                        else if (!strcmp(argv[i], "nis")) infosystem = INFO_NIS;
                        else if (!strcmp(argv[i], "YP")) infosystem = INFO_NIS;
                        else if (!strcmp(argv[i], "yp")) infosystem = INFO_NIS;
+                       else if (!strcasecmp(argv[i], "opendirectory")) infosystem = INFO_DIRECTORYSERVICES;
                        else
                        {
                                fprintf(stderr, "unknown info system \"%s\"\n", argv[i]);
@@ -156,15 +154,15 @@ main(int argc, char *argv[])
        
        switch (infosystem)
        {
-               case INFO_NETINFO:
-                       netinfo_check_passwd(user, locn);
-                       break;
                case INFO_FILE:
                        file_check_passwd(user, locn);
                        break;
                case INFO_NIS:
                        nis_check_passwd(user, locn);
                        break;
+               case INFO_DIRECTORYSERVICES:
+                       ds_check_passwd(user, locn);
+                       break;
        }
 
        exit(0);