home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / dsrght.exe / DSEFFECT.C next >
C/C++ Source or Header  |  1995-06-27  |  4KB  |  117 lines

  1. /****************************************************************************
  2. ** File:DSEFFECT.C
  3. **
  4. **    Description:
  5. **              This programs prompts for a user name and a server name then
  6. **              a call is made to NWDSGetEffectiveRights with these as parameters
  7. **              and the returned privileges are printed out.
  8. **
  9. **    Disclaimer:
  10. **
  11. **        Novell, Inc. makes no representations or warranties with respect to
  12. **        any NetWare software, and specifically disclaims any express or
  13. **        implied warranties of merchantability, title, or fitness for a
  14. **        particular purpose.
  15. **
  16. **        Distribution of any NetWare software is forbidden without the
  17. **        express written consent of Novell, Inc.  Further, Novell reserves
  18. **        the right to discontinue distribution of any NetWare software.
  19. **
  20. **        Novell is not responsible for lost profits or revenue, loss of use
  21. **        of the software, loss of data, costs of re-creating lost data, the
  22. **        cost of any substitute equipment or program, or claims by any party
  23. **        other than you.  Novell strongly recommends a backup be made before
  24. **        any software is installed.   Technical support for this software
  25. **        may be provided at the discretion of Novell.
  26. **
  27. **
  28. **
  29. **    Programmers:
  30. **
  31. **        Ini    Who                    Firm
  32. **        -----------------------------------------------------------------------
  33. **        MDP    Marina D Pimentel        Novell Developer Support
  34. **
  35. **    History:
  36. **
  37. **        When        Who    What
  38. **        -----------------------------------------------------------------------
  39. **        06-27-95    MDP    First code.
  40. **
  41. */
  42.  
  43. /*---------------------------------------------------------------------------
  44. ** Include headers, macros, structures, typedefs, etc.
  45. */
  46.  
  47. #define NWDOS
  48.  
  49. #include <stdio.h>
  50. #include <string.h>
  51. #include <nwcalls.h>
  52. #include <nwnet.h>
  53. #include <nwpsrv.h>
  54. #include <stdlib.h>
  55.  
  56. extern _stklen = (8 * 1024U);
  57.  
  58.  
  59. /*---------------------------------------------------------------------------
  60. **    Program start.
  61. */
  62.  
  63. void main()
  64. {
  65.   NWDSContextHandle   dContext;
  66.   NWDS_PRIVILEGES     mypriv;
  67.   NWDSCCODE           ccode;
  68.  
  69.   char myname[48];
  70.   char servername[48];
  71.   char buffer[48];
  72. /*---------------------------------------------------------------------------
  73. ** Include headers, macros, structures, typedefs, etc.
  74. */
  75.   ccode=NWCallsInit(NULL,NULL);
  76.   ccode = NWInitUnicodeTables(001, 437);
  77.   if(ccode)
  78.   {
  79.     printf("NWInitUnicodeTables returned [%x]\n",ccode);
  80.     goto cleanup;
  81.   }
  82.   dContext = NWDSCreateContext( );
  83.   if(dContext == ERR_CONTEXT_CREATION)
  84.   {
  85.     printf("Could not create context\n");
  86.     goto cleanup;
  87.   }
  88.   printf("Please enter server name\n");
  89.   gets(buffer);
  90.   strcpy(servername,strupr(buffer));
  91.   printf("Please enter user name\n");
  92.   gets(buffer);
  93.   strcpy(myname,strupr(buffer));
  94.   NWDSGetEffectiveRights(dContext,myname,servername,"[Entry Rights]",&mypriv);
  95.   if(ccode)
  96.   {
  97.     printf("NWGetEffectiveRights returned [%x]\n",ccode);
  98.     goto cleanup;
  99.   }
  100.   printf ("%s %s %s %s %s \n",
  101.        mypriv & DS_ENTRY_BROWSE       ? "Entry Browse"  : "-----",
  102.        mypriv & DS_ENTRY_ADD          ? "Entry Add"     : "-----",
  103.        mypriv & DS_ENTRY_DELETE       ? "Entry Delete"  : "-----",
  104.        mypriv & DS_ENTRY_RENAME       ? "Entry Rename"  : "-----",
  105.        mypriv & DS_ENTRY_SUPERVISOR   ? "Entry Superv"  : "-----");
  106. /*---------------------------------------------------------------------------
  107. ** Freeing memory.
  108. */
  109.   cleanup:
  110.   NWFreeUnicodeTables();
  111.   NWDSFreeContext(dContext);
  112. }
  113.  
  114.  
  115.  
  116.  
  117.