1 #if (!defined(lint) && !defined(SABER))
2 static char rcsid_module_c[] = "$Header$";
5 /* This is the file user.c for the MOIRA Client, which allows a nieve
6 * user to quickly and easily maintain most parts of the MOIRA database.
7 * It Contains: Functions for manipulating user information.
10 * By: Chris D. Peterson
16 * Copyright 1988 by the Massachusetts Institute of Technology.
18 * For further information on copyright and distribution
19 * see the file mit-copyright.h
25 #include <moira_site.h>
34 #include "mit-copyright.h"
45 #define DEFAULT_SHELL "/bin/csh"
46 #define DEFAULT_CLASS "?"
49 /* Function Name: UserState
50 * Description: Convert a numeric state into a descriptive string.
51 * Arguments: state value
52 * Returns: pointer to statically allocated string.
55 static char *states[] = { "Registerable (0)",
57 "Half Registered (2)",
59 "Not registerable (4)",
60 "Enrolled/Registerable (5)",
61 "Enrolled/Not Registerable (6)",
62 "Half Enrolled (7)" };
64 static char *UserState(state)
69 if (state < 0 || state >= US_END) {
70 sprintf(buf, "Unknown (%d)", state);
73 return(states[state]);
77 /* Function Name: PrintUserName
78 * Description: Print name of a user.
79 * Arguments: info - the information about a user.
87 char buf[BUFSIZ], print_buf[BUFSIZ];
88 sprintf(buf, "%s, %s %s", info[U_LAST], info[U_FIRST], info[U_MIDDLE]);
89 sprintf(print_buf, "%-40s User Name: %s", buf, info[U_NAME]);
90 Put_message(print_buf);
93 /* Function Name: PrintUserInfo
94 * Description: Prints Information about a user.
95 * Arguments: info - an argument list with the user information
104 char name[BUFSIZ], buf[BUFSIZ];
110 sprintf(name, "%s, %s %s", info[U_LAST], info[U_FIRST], info[U_MIDDLE]);
111 sprintf(buf, "Login name: %-20s Full name: %s", info[U_NAME], name);
113 sprintf(buf, "User id: %-23s Login shell %-10s Class: %s",
114 info[U_UID], info[U_SHELL], info[U_CLASS]);
118 sprintf(buf, "%s:%s", info[U_NAME], info[U_MITID]);
120 status = GDSS_Verify(buf, strlen(buf), info[U_SIGNATURE], &si);
122 hex_dump(info[U_SIGNATURE]);
123 sprintf(buf, "GDSS_Verify => %d", status);
130 sprintf(buf, "Account is: %-20s MIT ID number: %s Signed: %s",
131 UserState(atoi(info[U_STATE])), info[U_MITID],
132 *info[U_SIGNATURE] ? (status ? "Bad" : "Yes") : "No");
134 if (atoi(info[U_SECURE]))
135 sprintf(buf, "Secure password set on %s.", atot(info[U_SECURE]));
137 sprintf(buf, "No secure password set.");
139 sprintf(buf, "Comments: %s", info[U_COMMENT]);
141 sprintf(buf, MOD_FORMAT, info[U_MODBY], info[U_MODTIME],info[U_MODWITH]);
145 /* Function Name: SetUserDefaults
146 * Description: Sets the default values for add user.
147 * Arguments: info - a blank user info array of char *'s.
148 * Returns: args - the filled info structure.
152 SetUserDefaults(info)
155 info[U_NAME] = Strsave(UNIQUE_LOGIN);
156 info[U_UID] = Strsave(UNIQUE_UID);
157 info[U_SHELL] = Strsave(DEFAULT_SHELL);
158 info[U_LAST] = Strsave(DEFAULT_NONE);
159 info[U_FIRST] = Strsave(DEFAULT_NONE);
160 info[U_MIDDLE] = Strsave(DEFAULT_NONE);
161 info[U_STATE] = Strsave(DEFAULT_NO);
162 info[U_MITID] = Strsave(DEFAULT_NONE);
163 info[U_CLASS] = Strsave(DEFAULT_CLASS);
164 info[U_COMMENT] = Strsave("");
165 info[U_SIGNATURE] = Strsave("");
166 info[U_SECURE] = Strsave("0");
167 info[U_MODTIME] = info[U_MODBY] = info[U_MODWITH] = info[U_END] = NULL;
172 /* Check that the supplied name follows the capitalization rules, and
173 * offer to correct it if not.
176 CorrectCapitalization(name)
179 char temp_buf[BUFSIZ], fixname[BUFSIZ];
181 strcpy(fixname, *name);
183 if (strcmp(fixname, *name)) {
184 Put_message("You entered a name which does not follow the capitalization conventions.");
185 sprintf(temp_buf, "Correct it to \"%s\"", fixname);
186 if (YesNoQuestion(temp_buf, 1) == TRUE) {
188 *name = strsave(fixname);
194 /* Function Name: AskUserInfo.
195 * Description: This function askes the user for information about a
196 * machine and saves it into a structure.
197 * Arguments: info - a pointer the the structure to put the info into.
198 * flags - Flags asking us which info we want.
199 * Returns: the args to pass to the query.
200 * NOTES: the return args are not necessarily in the correct order to
201 * use the #defined names (e.g args[UID] is not the uid anymore).
205 AskUserInfo(info, name)
213 char temp_buf[BUFSIZ], *newname, *temp_ptr, *sig, sig_buf[BUFSIZ];
216 sprintf(temp_buf,"\nChanging Attributes of user %s.\n",info[U_NAME]);
217 Put_message(temp_buf);
219 struct qelem *elem = NULL;
222 if (GetValueFromUser("User's last name", &info[U_LAST]) == SUB_ERROR)
224 CorrectCapitalization(&info[U_LAST]);
225 if (GetValueFromUser("User's first name", &info[U_FIRST]) == SUB_ERROR)
227 CorrectCapitalization(&info[U_FIRST]);
228 if (GetValueFromUser("User's middle name", &info[U_MIDDLE]) ==
231 CorrectCapitalization(&info[U_MIDDLE]);
232 argv[0] = info[U_FIRST];
233 argv[1] = info[U_LAST];
234 if (do_mr_query("get_user_account_by_name", 2, argv,
235 StoreInfo, (char *) &elem) == 0) {
236 Put_message("A user by that name already exists in the database.");
237 Loop(QueueTop(elem), PrintUserInfo);
238 Loop(QueueTop(elem), FreeInfo);
240 if (YesNoQuestion("Add new user anyway", TRUE) != TRUE)
245 newname = Strsave(info[U_NAME]);
246 if (GetValueFromUser("The new login name for this user", &newname) ==
249 } else if (GetValueFromUser("Login name for this user", &info[U_NAME]) ==
253 if (GetValueFromUser("User's UID", &info[U_UID]) == SUB_ERROR)
255 if (GetValueFromUser("User's shell", &info[U_SHELL]) == SUB_ERROR)
258 if (GetValueFromUser("User's last name", &info[U_LAST]) == SUB_ERROR)
260 CorrectCapitalization(&info[U_LAST]);
261 if (GetValueFromUser("User's first name", &info[U_FIRST]) == SUB_ERROR)
263 CorrectCapitalization(&info[U_FIRST]);
264 if (GetValueFromUser("User's middle name", &info[U_MIDDLE]) ==
267 CorrectCapitalization(&info[U_MIDDLE]);
271 if (GetValueFromUser("User's status (? for help)", &info[U_STATE]) ==
274 if (isdigit(info[U_STATE][0]))
276 Put_message("Valid status numbers:");
277 for (i = 0; i < US_END; i++) {
278 sprintf(temp_buf, " %d: %s", i, states[i]);
279 Put_message(temp_buf);
282 if (GetValueFromUser("User's MIT ID number", &info[U_MITID]) == SUB_ERROR)
284 RemoveHyphens(info[U_MITID]);
285 if (GetTypeFromUser("User's MIT Year (class)", "class", &info[U_CLASS]) ==
288 if (GetValueFromUser("Comments", &info[U_COMMENT]) == SUB_ERROR)
291 if (YesNoQuestion("Secure password set",
292 atoi(info[U_SECURE]) ? TRUE : FALSE) == FALSE) {
293 free(info[U_SECURE]);
294 info[U_SECURE] = strsave("0");
295 } else if (!strcmp(info[U_SECURE], "0")) {
299 gettimeofday(&tv, (struct timezone *)NULL);
300 sprintf(buf, "%d", tv.tv_sec);
301 free(info[U_SECURE]);
302 info[U_SECURE] = strsave(buf);
307 if (strcmp(info[U_NAME], UNIQUE_LOGIN)) {
309 sprintf(temp_buf, "%s:%s", newname, info[U_MITID]);
311 sprintf(temp_buf, "%s:%s", info[U_NAME], info[U_MITID]);
313 i = GDSS_Verify(temp_buf, strlen(temp_buf), info[U_SIGNATURE], &si);
314 /* If it's already signed OK, don't resign it. */
315 if (i != GDSS_SUCCESS) {
316 free(info[U_SIGNATURE]);
317 info[U_SIGNATURE] = malloc(GDSS_Sig_Size() * 2);
319 i = GDSS_Sign(temp_buf, strlen(temp_buf), info[U_SIGNATURE]);
320 if (i != GDSS_SUCCESS)
321 com_err(program_name, gdss2et(i), "Failed to create signature");
323 unsigned char buf[256];
325 i = GDSS_Verify(temp_buf, strlen(temp_buf),
326 info[U_SIGNATURE], &si);
327 if (strlen(buf) > 68) {
329 Put_message("Signature too long, trying again");
335 Put_message("Made signature:");
337 Put_message("Don't need to remake signature");
341 hex_dump(info[U_SIGNATURE]);
345 info[U_SIGNATURE] = strsave("");
348 FreeAndClear(&info[U_MODTIME], TRUE);
349 FreeAndClear(&info[U_MODBY], TRUE);
350 FreeAndClear(&info[U_MODWITH], TRUE);
353 * Slide the newname into the #2 slot, this screws up all future references
354 * to this list, since we slip the pointer into a info list it gets freed
355 * when the rest of the list gets freed.
358 SlipInNewName(info, newname);
363 /* Function Name: GetUserInfo
364 * Description: Stores the user information in a queue.
365 * Arguments: type - type of field given to get info, one of:
366 * LOGIN, UID, BY_NAME, CLASS.
367 * name1 - name of thing specified by type (wildcards okay)
368 * name2 - other name, only used in get user by first and last.
370 * Returns: the first element of the queue containing the user info.
374 GetUserInfo(type, name1, name2)
380 struct qelem * elem = NULL;
385 if ( (status = do_mr_query("get_user_account_by_login", 1, args,
386 StoreInfo, (char *) &elem)) != 0) {
387 com_err(program_name, status,
388 " when attempting to get_user_account_by_login.");
394 if ( (status = do_mr_query("get_user_account_by_uid", 1, args,
395 StoreInfo, (char *) &elem)) != 0) {
396 com_err(program_name, status,
397 " when attempting to get_user_account_by_uid.");
404 if ( (status = do_mr_query("get_user_account_by_name", 2, args,
405 StoreInfo, (char *) &elem)) != 0) {
406 com_err(program_name, status,
407 " when attempting to get_user_account_by_name.");
413 if ( (status = do_mr_query("get_user_account_by_class", 1, args,
414 StoreInfo, (char *) &elem)) != 0) {
415 com_err(program_name, status,
416 " when attempting to get_user_account_by_class.");
422 if ( (status = do_mr_query("get_user_account_by_id", 1, args,
423 StoreInfo, (char *) &elem)) != 0) {
424 com_err(program_name, status,
425 " when attempting to get_user_account_by_id.");
430 return( QueueTop(elem) );
433 /* Function Name: AddNewUser
434 * Description: Adds a new user to the database.
436 * Returns: DM_NORMAL.
444 char ** args, *info[MAX_ARGS_SIZE];
446 if ((args = AskUserInfo(SetUserDefaults(info), FALSE)) == NULL) {
447 Put_message("Aborted.");
452 if ( (status = do_mr_query("add_user_account", CountArgs(args),
453 args, Scream, (char *) NULL)) != MR_SUCCESS)
454 com_err(program_name, status, " in add_user_account");
456 Put_message("New user added to database.");
462 /* Function Name: GetLoginName
463 * Description: Asks the user for a login name and reserves
466 * Returns: a malloced login name for the user.
475 if (GetValueFromUser("Login name for this user? ", &name) == SUB_ERROR)
477 Put_message("KERBEROS code not added, did not reserve name with kerberos.");
482 /* Function Name: ChooseUser
483 * Description: Choose a user from a list and return the uid.
484 * Arguments: top - a queue of user information.
485 * Returns: uid - the malloced uid of the user that was chosen.
492 while (elem != NULL) {
493 char ** info = (char **) elem->q_data;
495 switch(YesNoQuitQuestion("Is this the user you want (y/n/q)", FALSE)) {
497 return(Strsave(info[U_UID]));
500 default: /* quit or ^C. */
508 /* Function Name: GetUidNumberFromName
509 * Description: Gets the users uid number, from the name.
511 * Returns: uid - a malloced string containing the uid.
515 GetUidNumberFromName()
517 char *args[5], *uid, first[BUFSIZ], last[BUFSIZ];
519 struct qelem * top = NULL;
521 if (!Prompt_input("First Name: ", first, BUFSIZ))
523 if (!Prompt_input("Last Name: ", last, BUFSIZ))
531 switch (status = do_mr_query("get_user_account_by_name", 2, args,
532 StoreInfo, (char *) &top)) {
536 Put_message("There is no user in the database with that name.");
539 com_err(program_name, status, " in get_account_user_by_name.");
544 if (QueueCount(top) == 1) /* This is a unique name. */ {
545 char ** info = (char **) top->q_data;
546 Put_message("User ID Number retrieved for the user: ");
549 uid = Strsave(info[U_UID]);
551 return(Strsave(uid));
554 Put_message("That name is not unique, choose the user that you want.");
555 uid = ChooseUser(top);
560 /* Function Name: SetUserPassword
561 * Description: Set the new kerberos password for this user.
562 * Arguments: name - kerberos principle name for this user, (login name).
567 SetUserPassword(name)
570 name = name; /* make saber happy. */
571 Put_message("Kerberos password not changed, code non-existant.");
572 /* clever message to call account_admin, if this fails. */
575 /* Function Name: GiveBackLogin
576 * Description: Gives back previously reserved kerberous principle.
577 * Arguments: name - principle to give back.
585 name = name; /* make saber happy. */
586 Put_message("kerberos code not implimented, name not given back.");
587 /* send mail to db maintainer if this fails. */
590 /* Function Name: RegisterUser
591 * Description: This function registers a user.
593 * Returns: DM_NORMAL.
599 char * args[MAX_ARGS_SIZE];
600 char *login, *fstype = NULL;
601 char temp_buf[BUFSIZ];
604 Put_message("This function has NO kerberos support, so strange things");
605 Put_message("may happen if you use it to register a user.");
607 switch (YesNoQuestion("Do you know the users UID Number (y/n)", FALSE)) {
609 Prompt_input("What is the UID number of the user? ", temp_buf, BUFSIZ);
610 args[0] = Strsave(temp_buf);
613 if ( (args[0] = GetUidNumberFromName()) == NULL)
620 if ( ((login = args[1] = GetLoginName()) == NULL) ||
621 ( GetFSTypes(&fstype, FALSE) == SUB_ERROR ) ) {
622 FreeInfo(args); /* This work because the NULL temination is ok. */
628 switch (status = do_mr_query("register_user", CountArgs(args),
629 args, Scream, (char *) NULL)) {
631 sprintf(temp_buf, "User %s successfully registered.", login);
632 Put_message(temp_buf);
633 SetUserPassword(login);
636 GiveBackLogin(login);
637 sprintf(temp_buf, "The username %s is already in use.", login);
638 Put_message(temp_buf);
641 com_err(program_name, status, " in register_user");
648 /* Function Name: RealUpdateUser
649 * Description: actuall updates the user information.
650 * Arguments: info - all current information for the user fields.
651 * junk - an UNUSED boolean.
657 RealUpdateUser(info, junk)
662 char error_buf[BUFSIZ];
663 char ** args = AskUserInfo(info, TRUE);
666 Put_message("Aborted.");
669 if ( (status = do_mr_query("update_user_account", CountArgs(args),
670 args, Scream, (char *) NULL)) != MR_SUCCESS) {
671 com_err(program_name, status, " in ModifyFields");
672 sprintf(error_buf, "User %s not updated due to errors.", info[NAME]);
673 Put_message(error_buf);
677 /* Function Name: UpdateUser
678 * Description: Modify some of the information about a user.
679 * Arguments: argc, argv - login name of the user in argv[1].
680 * Returns: DM_NORMAL.
685 UpdateUser(argc, argv)
691 elem = GetUserInfo(LOGIN, argv[1], (char *) NULL);
692 QueryLoop(elem, NullPrint, RealUpdateUser, "Update the user");
698 /* Function Name: RealDeactivateUser
699 * Description: sets the user's status to 3.
700 * Arguments: info - all current information for the user fields
701 * one_item - indicates the user hasn't been queried yet
706 RealDeactivateUser(info, one_item)
711 char txt_buf[BUFSIZ];
712 char * qargs[2], **args;
713 struct qelem *elem = NULL;
716 sprintf(txt_buf, "Deactivate user %s (y/n)", info[NAME]);
717 if (YesNoQuestion(txt_buf, FALSE) != TRUE)
721 qargs[0] = info[NAME];
723 if ((status = do_mr_query("update_user_status", 2, qargs, Scream,
724 (char *) NULL)) != MR_SUCCESS) {
725 com_err(program_name, status, " in update_user_status");
726 sprintf(txt_buf, "User %s not deactivated due to errors.", info[NAME]);
727 Put_message(txt_buf);
728 } else if (YesNoQuestion("Also deactivate matching list and filesystem (y/n)",
730 if (status = do_mr_query("get_list_info", 1, &(info[NAME]),
731 StoreInfo, (char *) &elem)) {
732 com_err(program_name, status, " getting list info, not deactivating list or filesystem");
735 args =(char **) (QueueTop(elem)->q_data);
736 free(args[L_ACTIVE]);
737 args[L_ACTIVE] = strsave("0");
738 FreeAndClear(&args[L_MODTIME], TRUE);
739 FreeAndClear(&args[L_MODBY], TRUE);
740 FreeAndClear(&args[L_MODWITH], TRUE);
741 SlipInNewName(args, args[L_NAME]);
742 if (status = do_mr_query("update_list", CountArgs(args), args,
743 Scream, (char *) NULL)) {
744 com_err(program_name, status, " updating list, not deactivating list or filesystem");
751 elem = (struct qelem *) NULL;
752 if (status = do_mr_query("get_filesys_by_label", 1, &(info[NAME]),
753 StoreInfo, (char *) &elem)) {
754 com_err(program_name, status, " getting filsys info, not deactivating filesystem");
759 args = (char **) (QueueTop(elem)->q_data);
761 args[FS_TYPE] = strsave("ERR");
762 free(args[FS_COMMENTS]);
763 args[FS_COMMENTS] = strsave("Locker disabled; call 3-1325 for help");
764 FreeAndClear(&args[FS_MODTIME], TRUE);
765 FreeAndClear(&args[FS_MODBY], TRUE);
766 FreeAndClear(&args[FS_MODWITH], TRUE);
767 SlipInNewName(args, args[FS_NAME]);
768 if (status = do_mr_query("update_filesys", CountArgs(args), args,
769 Scream, (char *) NULL)) {
770 com_err(program_name, status, " updating filesystem, not deactivating filesystem");
781 /* Function Name: DeactivateUser
782 * Description: sets the user's status to 3.
783 * Arguments: argc, argv - login name of the user in argv[1].
784 * Returns: DM_NORMAL.
789 DeactivateUser(argc, argv)
795 elem = GetUserInfo(LOGIN, argv[1], (char *) NULL);
796 QueryLoop(elem, NullPrint, RealDeactivateUser, "Deactivate user");
803 /* ------------------------- Top Menu ------------------------- */
805 /* DeleteUser() in delete.c */
807 /* Function Name: DeleteUserByUid
808 * Description: Deletes the user given a uid number.
809 * Arguments: argc, argv - uid if user in argv[1].
810 * Returns: DM_NORMAL.
811 * NOTES: This just gets the username from the mr server
812 * and performs a DeleteUser().
816 DeleteUserByUid(argc, argv)
821 struct qelem *elem = NULL;
824 if(!ValidName(argv[1]))
827 if ( (status = do_mr_query("get_user_account_by_uid", 1, argv+1, StoreInfo,
828 (char * ) &elem)) != MR_SUCCESS)
829 com_err(program_name, status, " in get_user_account_by_uid");
831 info = (char **) elem->q_data;
832 argv[1] = info[U_NAME];
834 (void) DeleteUser(argc, argv);
838 /* ------------------------- Show User Information ------------------------- */
840 /* Function Name: ShowUserByLogin
841 * Description: Shows user information given a login name.
842 * Arguments: argc, argv - login name in argv[1].
848 ShowUserByLogin(argc, argv)
852 struct qelem *top, *elem;
854 elem = top = GetUserInfo(LOGIN, argv[1], (char *) NULL);
855 Loop(elem, PrintUserInfo);
861 /* Function Name: RetrieveUserByName
862 * Description: Show information on a user give fist and/or last name.
863 * Arguments: argc, argv - argv[1] - first name.
864 * argv[2] - last name.
865 * Returns: DM_NORMAL.
870 ShowUserByName(argc, argv)
877 top = GetUserInfo(BY_NAME, argv[1], argv[2]);
879 if (top == NULL) /* if there was an error then return. */
882 if (!PromptWithDefault("Print full information, or just the names (f/n)?",
889 Loop(top, PrintUserInfo);
893 Loop(top, PrintUserName);
901 /* Function Name: ShowUserByClass
902 * Description: Shows real and login names of all users in class.
903 * Arguments: argc, argv - argv[1] contains the class.
909 ShowUserByClass(argc, argv)
915 if (YesNoQuestion("This will take a long time. Are you sure", 0) == FALSE)
917 top = GetUserInfo(CLASS, argv[1], (char *) NULL);
918 Loop(top, PrintUserName);
925 /* Function Name: ShowUserById
926 * Description: Shows user information given an ID number.
927 * Arguments: argc, argv - ID number in argv[1].
933 ShowUserById(argc, argv)
937 struct qelem *top, *elem;
939 elem = top = GetUserInfo(ID, argv[1], (char *) NULL);
940 Loop(elem, PrintUserInfo);
947 /* Function Name: GetKrbmap
948 * Description: Shows user <-> Kerberos mappings
949 * Arguments: argc, argv - argv[1] contains the user login name,
950 * argv[2] contains the principal
956 GetKrbmap(argc, argv)
961 struct qelem *elem = NULL, *top;
964 if ((stat = do_mr_query("get_kerberos_user_map", 2, &argv[1],
965 StoreInfo, (char *)&elem)) != 0) {
966 com_err(program_name, stat, " in GetKrbMap.");
970 top = elem = QueueTop(elem);
972 while (elem != NULL) {
973 char **info = (char **) elem->q_data;
974 sprintf(buf, "User: %-9s Principal: %s",
975 info[KMAP_USER], info[KMAP_PRINCIPAL]);
980 FreeQueue(QueueTop(top));
985 /* Function Name: AddKrbmap
986 * Description: Add a new user <-> Kerberos mapping
987 * Arguments: argc, argv - argv[1] contains the user login name,
988 * argv[2] contains the principal
994 AddKrbmap(argc, argv)
1000 if (!index(argv[KMAP_PRINCIPAL + 1], '@')) {
1001 Put_message("Please specify a realm for the kerberos principal.");
1004 if ((stat = do_mr_query("add_kerberos_user_map", 2, &argv[1],
1005 Scream, NULL)) != 0) {
1006 com_err(program_name, stat, " in AddKrbMap.");
1007 if (stat == MR_EXISTS)
1008 Put_message("No user or principal may have more than one mapping.");
1014 /* Function Name: DeleteKrbmap
1015 * Description: Remove a user <-> Kerberos mapping
1016 * Arguments: argc, argv - argv[1] contains the user login name,
1017 * argv[2] contains the principal
1023 DeleteKrbmap(argc, argv)
1029 if ((stat = do_mr_query("delete_kerberos_user_map", 2, &argv[1],
1030 Scream, NULL)) != 0) {
1031 com_err(program_name, stat, " in DeleteKrbMap.");
1043 sprintf(buf, "Size: %d", strlen(p));
1045 while (strlen(p) >= 8) {
1046 sprintf(buf, "%02x %02x %02x %02x %02x %02x %02x %02x",
1047 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
1051 switch (strlen(p)) {
1053 sprintf(buf, "%02x %02x %02x %02x %02x %02x %02x",
1054 p[0], p[1], p[2], p[3], p[4], p[5], p[6]);
1057 sprintf(buf, "%02x %02x %02x %02x %02x %02x",
1058 p[0], p[1], p[2], p[3], p[4], p[5]);
1061 sprintf(buf, "%02x %02x %02x %02x %02x",
1062 p[0], p[1], p[2], p[3], p[4]);
1065 sprintf(buf, "%02x %02x %02x %02x",
1066 p[0], p[1], p[2], p[3]);
1069 sprintf(buf, "%02x %02x %02x",
1073 sprintf(buf, "%02x %02x",
1077 sprintf(buf, "%02x",