]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-pts-20070811
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 12 Aug 2007 00:54:04 +0000 (00:54 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 12 Aug 2007 00:54:04 +0000 (00:54 +0000)
remove SUPERGROUPS condition for compilation of pts commands:
  Interactive, Quit, Source, Sleep

fix the assignment of 'source' to permit it to function

replace bcopy and bzero with memcpy and memset to permit compilation
on Windows

replace ubik_Call(xxx) with ubik_xxx() (testpt.c)

add -DSUPERGROUPS and map.c to NTMakefile

====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================

rename functions to avoid Win32 conflicts

(cherry picked from commit 58d5f38b10b35ab3712eacde60f2a06fb2f2a062)

src/ptserver/NTMakefile
src/ptserver/db_verify.c
src/ptserver/map.c
src/ptserver/ptclient.c
src/ptserver/pts.c
src/ptserver/ptutils.c
src/ptserver/testpt.c

index 2df944427432455f125dd38eecd018c794e0afe3..d97f574ec5e3f192633202186c50108bbd875cfb 100644 (file)
@@ -10,7 +10,7 @@
 RELDIR=ptserver
 !INCLUDE ..\config\NTMakefile.$(SYS_NAME)
 !include ..\config\NTMakefile.version
-AFSDEV_AUXCDEFINES = -DAFS_USE_GETTIMEOFDAY
+AFSDEV_AUXCDEFINES = -DAFS_USE_GETTIMEOFDAY -DSUPERGROUPS
 
 ############################################################################
 # Definitions for installing header files
@@ -52,6 +52,7 @@ PTSERVER_EXEOBJS =\
        $(OUT)\ptutils.obj \
        $(OUT)\ptprocs.obj \
        $(OUT)\utils.obj \
+        $(OUT)\map.obj \
        $(OUT)\ptserver.res
 
 
index 144623f5e25887ed75c2be8f82f285074a3d0a2d..62c5f2c428498757da6810b49339b22ad0716243 100644 (file)
@@ -1516,7 +1516,7 @@ void
 zeromap(struct idused *idmap)
 {
     while (idmap) {
-       bzero((char *)idmap->idcount, sizeof idmap->idcount);
+       memset((char *)idmap->idcount, 0, sizeof idmap->idcount);
        idmap = idmap->idnext;
     }
 }
@@ -1541,7 +1541,7 @@ inccount(struct idused **idmapp, int id)
            perror("idmap");
            exit(1);
        }
-       bzero((char *)idmap, sizeof idmap);
+       memset((char *)idmap, 0, sizeof idmap);
        idmap->idstart = id & ~(IDCOUNT - 1);
        idmap->idnext = *idmapp;
        *idmapp = idmap;
index 85d23ff9af8c7fff2700262c61e5f112e259a378..a043f40b5f11d28212d8aaed8c663857db9ca5aa 100644 (file)
@@ -37,7 +37,7 @@ RCSID
 #ifdef SUPERGROUPS
 #include <errno.h>
 #include "map.h"
-char *malloc();
+#include "malloc.h"
 
 #undef PRINT_MAP_ERROR
 /* #define MAP_DEBUG /**/
index 0918e40f671714e5e0238ce2cf4026d1119947f6..ba24d62646fe6a1e04614d31fc24d29db962406a 100644 (file)
@@ -648,7 +648,7 @@ main(argc, argv)
        else if (!strcmp(op, "fih")) {
            char tname[128];
            struct PrUpdateEntry uentry;
-           bzero(&uentry, sizeof(uentry));
+           memset(&uentry, 0, sizeof(uentry));
            /* scanf("%s",name); */
            if (GetString(name, sizeof(name))) {
                code = PRBADARG;
@@ -675,7 +675,7 @@ main(argc, argv)
        } else if (!strcmp(op, "fnh")) {
            int tid;
            struct PrUpdateEntry uentry;
-           bzero(&uentry, sizeof(uentry));
+           memset(&uentry, 0, sizeof(uentry));
            /* scanf("%d", &id); */
            if (GetInt32(&id)) {
                code = PRBADARG;
index 4c64f4651e677a5980f03690d4ff20cd78dc857f..12362f17699985f354f9e6418338ba07ab9c76b6 100644 (file)
@@ -7,18 +7,6 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
-/*
- *                      (3) add new pts commands:
- *
- *                          Interactive - allow the pts command
- *                                        to be run interactively.
- *                          Quit        - quit interactive mode.
- *                          Source      - allow input to come from a file(s).
- *                          Sleep       - pause for a specified number
- *                                        of seconds.
- *
- */
-
 #include <afsconfig.h>
 #include <afs/param.h>
 
@@ -53,17 +41,6 @@ RCSID
 char *whoami;
 int force = 0;
 
-#if defined(SUPERGROUPS)
-
-/*
- *  Add new pts commands:
- *
- *      Interactive - allow the pts command to be run interactively.
- *      Quit        - quit interactive mode.
- *      Source      - allow input to come from a file(s).
- *      Sleep       - pause for a specified number of seconds.
- */
-
 static int finished;
 static FILE *source;
 extern struct ubik_client *pruclient;
@@ -74,21 +51,21 @@ struct sourcestack {
 } *shead;
 
 int
-Interactive(register struct cmd_syndesc *as)
+pts_Interactive(register struct cmd_syndesc *as)
 {
     finished = 0;
     return 0;
 }
 
 int
-Quit(register struct cmd_syndesc *as)
+pts_Quit(register struct cmd_syndesc *as)
 {
     finished = 1;
     return 0;
 }
 
 int
-Source(register struct cmd_syndesc *as)
+pts_Source(register struct cmd_syndesc *as)
 {
     FILE *fd;
     struct sourcestack *sp;
@@ -116,7 +93,7 @@ Source(register struct cmd_syndesc *as)
 }
 
 int
-Sleep(register struct cmd_syndesc *as)
+pts_Sleep(register struct cmd_syndesc *as)
 {
     int delay;
     if (!as->parms[0].items) {
@@ -125,6 +102,7 @@ Sleep(register struct cmd_syndesc *as)
     }
     delay = atoi(as->parms[0].items->data);
     IOMGR_Sleep(delay);
+    return 0;
 }
 
 int
@@ -141,8 +119,6 @@ popsource()
     return 1;
 }
 
-#endif /* SUPERGROUPS */
-
 int
 osi_audit()
 {
@@ -188,7 +164,6 @@ GetGlobals(register struct cmd_syndesc *as)
 int
 CleanUp(register struct cmd_syndesc *as)
 {
-#if defined(SUPERGROUPS)
     if (as && !strcmp(as->name, "help"))
        return 0;
     if (pruclient) {
@@ -196,14 +171,6 @@ CleanUp(register struct cmd_syndesc *as)
        pr_End();
        rx_Finalize();
     }
-#else
-    if (!strcmp(as->name, "help"))
-       return 0;
-    /* Need to shutdown the ubik_client & other connections */
-    pr_End();
-    rx_Finalize();
-#endif /* SUPERGROUPS */
-
     return 0;
 }
 
@@ -237,12 +204,12 @@ CreateGroup(register struct cmd_syndesc *as)
                        id);
                return code;
            }
-#if defined(SUPERGROUPS)
-           if (id == 0) {
+           
+            if (id == 0) {
                printf("0 isn't a valid user id; aborting\n");
                return EINVAL;
            }
-#endif
+
            idi = idi->next;
        } else
            id = 0;
@@ -1023,13 +990,13 @@ main(int argc, char **argv)
 {
     register afs_int32 code;
     register struct cmd_syndesc *ts;
-#if defined(SUPERGROUPS)
+
     char line[2048];
     char *cp, *lastp;
     int parsec;
     char *parsev[CMD_MAXPARMS];
     char *savec;
-#endif
+
 #ifdef WIN32
     WSADATA WSAjunk;
 #endif
@@ -1138,29 +1105,24 @@ main(int argc, char **argv)
     cmd_AddParm(ts, "-groups", CMD_FLAG, CMD_OPTIONAL, "list group entries");
     add_std_args(ts);
 
-#if defined(SUPERGROUPS)
-
-    ts = cmd_CreateSyntax("interactive", Interactive, 0,
+    ts = cmd_CreateSyntax("interactive", pts_Interactive, 0,
                          "enter interactive mode");
     add_std_args(ts);
     cmd_CreateAlias(ts, "in");
 
-    ts = cmd_CreateSyntax("quit", Quit, 0, "exit program");
+    ts = cmd_CreateSyntax("quit", pts_Quit, 0, "exit program");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("source", Source, 0, "read commands from file");
+    ts = cmd_CreateSyntax("source", pts_Source, 0, "read commands from file");
     cmd_AddParm(ts, "-file", CMD_SINGLE, 0, "filename");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("sleep", Sleep, 0, "pause for a bit");
+    ts = cmd_CreateSyntax("sleep", pts_Sleep, 0, "pause for a bit");
     cmd_AddParm(ts, "-delay", CMD_SINGLE, 0, "seconds");
     add_std_args(ts);
 
-#endif /* SUPERGROUPS */
-
     cmd_SetBeforeProc(GetGlobals, 0);
 
-#if defined(SUPERGROUPS)
     finished = 1;
     if (code = cmd_Dispatch(argc, argv)) {
        CleanUp(0);
@@ -1200,11 +1162,5 @@ main(int argc, char **argv)
     }
     CleanUp(0);
     exit(0);
-
-#else /* SUPERGROUPS */
-
-    cmd_SetAfterProc(CleanUp, 0);
-    code = cmd_Dispatch(argc, argv);
-    exit(code != 0);
-#endif /* SUPERGROUPS */
 }
+
index 53704a0272c2dc8964d8e04c64e62420a23b2f36..f7ad70d435529c750e4e0ec882f26d2abc66810a 100644 (file)
@@ -848,7 +848,7 @@ RemoveFromSGEntry(register struct ubik_trans *at, register afs_int32 aid, regist
        }                       /* for all coentry slots */
        hloc = nptr;
        nptr = centry.next;
-       bcopy((char *)&centry, (char *)&hentry, sizeof(centry));
+       memcpy((char *)&centry, (char *)&hentry, sizeof(centry));
     }                          /* while there are coentries */
     return PRNOENT;
 }
index 0655b847d291a55980a0eb883f6951838d0d1398..064cf54f51e0ec33258ba140e3d2439e3be1a713 100644 (file)
@@ -308,14 +308,14 @@ CreateGroup(int g)
     }
 
     sprintf(name, "%s:%s%d", ownerName, createPrefix, g);
-    code = ubik_Call(PR_NewEntry, pruclient, 0, name, PRGRP, owner, &id);
+    code = ubik_PR_NewEntry(pruclient, 0, name, PRGRP, owner, &id);
     if (code) {
        if (code == PREXIST) {
            code = pr_Delete(name);
            if (code == 0) {
                nGDels++;
                code =
-                   ubik_Call(PR_NewEntry, pruclient, 0, name, PRGRP, owner,
+                   ubik_PR_NewEntry(pruclient, 0, name, PRGRP, owner,
                              &id);
                if (code == 0) {
                    if (verbose)
@@ -351,7 +351,7 @@ DeleteRandomId(afs_int32 *list)
     for (j = 0; j < number; j++) {     /* find an undeleted id */
        m = (k + j) % number;
        if (id = list[m]) {
-           code = ubik_Call(PR_Delete, pruclient, 0, id);
+           code = ubik_PR_Delete(pruclient, 0, id);
            if (code) {
                afs_com_err(whoami, code, "Couldn't delete %di", id);
                exit(22);
@@ -379,7 +379,7 @@ AddUser(int u, int g)
        CreateGroup(g);
     ui = users[u];
     gi = groups[g];
-    code = ubik_Call(PR_AddToGroup, pruclient, 0, ui, gi);
+    code = ubik_PR_AddToGroup(pruclient, 0, ui, gi);
     if (code) {
        afs_com_err(whoami, code, "couldn't add %d to %d", ui, gi);
        exit(14);
@@ -398,7 +398,7 @@ RemUser(int u, int g)
 
     ui = users[u];
     gi = groups[g];
-    code = ubik_Call(PR_RemoveFromGroup, pruclient, 0, ui, gi);
+    code = ubik_PR_RemoveFromGroup(pruclient, 0, ui, gi);
     if (code) {
        afs_com_err(whoami, code, "couldn't remove %d from %d", ui, gi);
        exit(14);
@@ -656,7 +656,7 @@ TestManyMembers(struct cmd_syndesc *as, char *arock)
                }
 #define GETOWNED(xlist,xid) \
   (xlist).prlist_val = 0; (xlist).prlist_len = 0; \
-  code = ubik_Call (PR_ListOwned, pruclient, 0, (xid), &(xlist), &over); \
+  code = ubik_PR_ListOwned(pruclient, 0, (xid), &(xlist), &over); \
   if (code) { \
       afs_com_err (whoami, code, "getting owner list of (%di)", (xid)); \
       exit (23); } \