Changeset 448 for branches/client-1.6/src
- Timestamp:
- Apr 23, 2010, 10:04:41 AM (15 years ago)
- Location:
- branches/client-1.6/src
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/client-1.6/src/Makefile.kmk
r447 r448 94 94 95 95 # add new dependancy on build level info 96 rc/rc.rc : rc/description.rc version.h96 rc/rc.rc : rc/description.rc nversion.h 97 97 98 98 # update bldlevel info … … 103 103 104 104 # compile help file 105 $(PATH_BIN)/en/ndpsmb.hlp: ./help/ndpsmb.ipf version.h Config.kmk105 $(PATH_BIN)/en/ndpsmb.hlp: ./help/ndpsmb.ipf nversion.h Config.kmk 106 106 -@mkdir $(PATH_OBJ) 107 107 -@mkdir $(PATH_OBJ)\en … … 111 111 $(TOOLKIT)\bin\ipfc.exe $(PATH_OBJ)/en/ndpsmb.ipf $(PATH_BIN)/en/ndpsmb.hlp /COUNTRY=001 /CODEPAGE=850 112 112 113 $(PATH_BIN)/fr/ndpsmb.hlp: ./help/ndpsmb_fr.ipf version.h Config.kmk113 $(PATH_BIN)/fr/ndpsmb.hlp: ./help/ndpsmb_fr.ipf nversion.h Config.kmk 114 114 -@mkdir $(PATH_OBJ) 115 115 -@mkdir $(PATH_OBJ)\fr … … 119 119 $(TOOLKIT)\bin\ipfc.exe $(PATH_OBJ)/fr/ndpsmb.ipf $(PATH_BIN)/fr/ndpsmb.hlp /COUNTRY=001 /CODEPAGE=850 120 120 121 $(PATH_BIN)/de/ndpsmb.hlp: ./help/ndpsmb_de.ipf version.h Config.kmk121 $(PATH_BIN)/de/ndpsmb.hlp: ./help/ndpsmb_de.ipf nversion.h Config.kmk 122 122 -@mkdir $(PATH_OBJ) 123 123 -@mkdir $(PATH_OBJ)\de … … 128 128 129 129 130 # substitute macros in version.h131 version.h: Config.kmkversion.tpl132 $(QUIET)$(SED) "s;_VERSION_;$(VERSION);g" version.tpl \130 # substitute macros in nversion.h 131 nversion.h: Config.kmk nversion.tpl 132 $(QUIET)$(SED) "s;_VERSION_;$(VERSION);g" nversion.tpl \ 133 133 | $(SED) "s;_WPIVERSION_;$(subst .,\\\,$(VERSION));g" \ 134 134 | $(SED) "s;_BUILD_;$(BUILD);g" \ 135 > version.h135 > nversion.h 136 136 137 137 # substitute macros in docs -
branches/client-1.6/src/debug.c
r447 r448 29 29 #include <sys/time.h> 30 30 #include <sys/stat.h> 31 #include " version.h"31 #include "nversion.h" 32 32 33 33 int debuglevel = 9; // we set it to 9, so we get all messages … … 107 107 if (firstLogLine) 108 108 { 109 fprintf(f, "Samba client %s build %s \n", VERSION, BUILD);109 fprintf(f, "Samba client %s build %s based on %s\n", VERSION, BUILD, smbwrp_getVersion()); 110 110 firstLogLine = FALSE; 111 111 } -
branches/client-1.6/src/smbwrp.c
r444 r448 37 37 } 38 38 39 static int 40 net_share_enum_rpc(struct cli_state *cli, 41 void (*fn)(const char *name, 42 uint32 type, 43 const char *comment, 44 void *state), 45 void *state) 46 { 47 int i; 48 NTSTATUS status; 49 WERROR werr; 50 uint32_t resume_handle = 0; 51 uint32_t total_entries = 0; 52 struct srvsvc_NetShareInfoCtr info_ctr; 53 struct srvsvc_NetShareCtr1 ctr1; 54 fstring name = ""; 55 fstring comment = ""; 56 void *mem_ctx; 57 struct rpc_pipe_client *pipe_hnd; 58 59 /* Open the server service pipe */ 60 status = cli_rpc_pipe_open_noauth(cli, &ndr_table_srvsvc.syntax_id, &pipe_hnd); 61 if (!NT_STATUS_IS_OK(status)) { 62 DEBUG(1, ("net_share_enum_rpc pipe open fail!\n")); 63 return -1; 64 } 65 66 /* Allocate a context for parsing and for the entries in "ctr" */ 67 mem_ctx = talloc_init("libsmbclient: net_share_enum_rpc"); 68 if (mem_ctx == NULL) { 69 DEBUG(0, ("out of memory for net_share_enum_rpc!\n")); 70 TALLOC_FREE(pipe_hnd); 71 return -1; 72 } 73 74 /* Issue the NetShareEnum RPC call and retrieve the response */ 75 ZERO_STRUCT(info_ctr); 76 ZERO_STRUCT(ctr1); 77 info_ctr.level = 1; 78 info_ctr.ctr.ctr1 = &ctr1; 79 status = rpccli_srvsvc_NetShareEnumAll(pipe_hnd, mem_ctx, 80 pipe_hnd->desthost, 81 &info_ctr, 82 0xffffffff, 83 &total_entries, 84 &resume_handle, 85 &werr); 86 87 /* Was it successful? */ 88 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(werr) || info_ctr.ctr.ctr1->count == 0) { 89 /* Nope. Go clean up. */ 90 goto done; 91 } 92 93 /* For each returned entry... */ 94 for (i = 0; i < info_ctr.ctr.ctr1->count; i++) { 95 struct srvsvc_NetShareInfo1 info = info_ctr.ctr.ctr1->array[i]; 96 97 /* Add this share to the list */ 98 (*fn)(info.name, info.type, info.comment, state); 99 } 100 101 done: 102 /* Close the server service pipe */ 103 TALLOC_FREE(pipe_hnd); 104 105 /* Free all memory which was allocated for this request */ 106 TALLOC_FREE(mem_ctx); 107 108 /* Tell 'em if it worked */ 109 return W_ERROR_IS_OK(status) ? 0 : -1; 110 } 111 112 /* 113 * Wrapper for cli_errno to return not connected error on negative fd 114 * Now returns an OS/2 return code instead of lerrno. 115 */ 116 int os2cli_errno(cli_state * cli) 117 { 118 if (cli->fd == -1) 119 { 120 return maperror( ENOTCONN); 121 } 122 return maperror(cli_errno(cli)); 123 } 124 39 125 void smbwrp_Logging() 40 126 { … … 59 145 60 146 } 61 62 static int 63 net_share_enum_rpc(struct cli_state *cli, 64 void (*fn)(const char *name, 65 uint32 type, 66 const char *comment, 67 void *state), 68 void *state) 69 { 70 int i; 71 NTSTATUS status; 72 WERROR werr; 73 uint32_t resume_handle = 0; 74 uint32_t total_entries = 0; 75 struct srvsvc_NetShareInfoCtr info_ctr; 76 struct srvsvc_NetShareCtr1 ctr1; 77 fstring name = ""; 78 fstring comment = ""; 79 void *mem_ctx; 80 struct rpc_pipe_client *pipe_hnd; 81 82 /* Open the server service pipe */ 83 status = cli_rpc_pipe_open_noauth(cli, &ndr_table_srvsvc.syntax_id, &pipe_hnd); 84 if (!NT_STATUS_IS_OK(status)) { 85 DEBUG(1, ("net_share_enum_rpc pipe open fail!\n")); 86 return -1; 87 } 88 89 /* Allocate a context for parsing and for the entries in "ctr" */ 90 mem_ctx = talloc_init("libsmbclient: net_share_enum_rpc"); 91 if (mem_ctx == NULL) { 92 DEBUG(0, ("out of memory for net_share_enum_rpc!\n")); 93 TALLOC_FREE(pipe_hnd); 94 return -1; 95 } 96 97 /* Issue the NetShareEnum RPC call and retrieve the response */ 98 ZERO_STRUCT(info_ctr); 99 ZERO_STRUCT(ctr1); 100 info_ctr.level = 1; 101 info_ctr.ctr.ctr1 = &ctr1; 102 status = rpccli_srvsvc_NetShareEnumAll(pipe_hnd, mem_ctx, 103 pipe_hnd->desthost, 104 &info_ctr, 105 0xffffffff, 106 &total_entries, 107 &resume_handle, 108 &werr); 109 110 /* Was it successful? */ 111 if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(werr) || info_ctr.ctr.ctr1->count == 0) { 112 /* Nope. Go clean up. */ 113 goto done; 114 } 115 116 /* For each returned entry... */ 117 for (i = 0; i < info_ctr.ctr.ctr1->count; i++) { 118 struct srvsvc_NetShareInfo1 info = info_ctr.ctr.ctr1->array[i]; 119 120 /* Add this share to the list */ 121 (*fn)(info.name, info.type, info.comment, state); 122 } 123 124 done: 125 /* Close the server service pipe */ 126 TALLOC_FREE(pipe_hnd); 127 128 /* Free all memory which was allocated for this request */ 129 TALLOC_FREE(mem_ctx); 130 131 /* Tell 'em if it worked */ 132 return W_ERROR_IS_OK(status) ? 0 : -1; 133 } 134 135 /* 136 * Wrapper for cli_errno to return not connected error on negative fd 137 * Now returns an OS/2 return code instead of lerrno. 138 */ 139 int os2cli_errno(cli_state * cli) 140 { 141 if (cli->fd == -1) 142 { 143 return maperror( ENOTCONN); 144 } 145 return maperror(cli_errno(cli)); 147 const char * smbwrp_getVersion() 148 { 149 return SAMBA_VERSION_STRING; 146 150 } 147 151
Note:
See TracChangeset
for help on using the changeset viewer.