attachRemoteServiceManager @brief Opens connection with service manager on server using protocol, login username/password. @param status @param username @param password @param protocol @param server **/
| 154 | |
| 155 | **/ |
| 156 | isc_svc_handle attachRemoteServiceManager(ISC_STATUS* status, |
| 157 | const TEXT* username, |
| 158 | const TEXT* password, |
| 159 | bool trusted, |
| 160 | int protocol, |
| 161 | const TEXT* server) |
| 162 | { |
| 163 | char service[SERVICE_SIZE]; |
| 164 | |
| 165 | if (! serverSizeValidate(status, server)) |
| 166 | { |
| 167 | return 0; |
| 168 | } |
| 169 | |
| 170 | switch (protocol) |
| 171 | { |
| 172 | case sec_protocol_tcpip: |
| 173 | if (! isValidServer(status, server)) |
| 174 | { |
| 175 | return 0; |
| 176 | } |
| 177 | strncpy(service, server, SERVER_PART); |
| 178 | strcat(service, ":"); |
| 179 | break; |
| 180 | |
| 181 | case sec_protocol_netbeui: |
| 182 | if (! isValidServer(status, server)) |
| 183 | { |
| 184 | return 0; |
| 185 | } |
| 186 | strcpy(service, "\\\\"); |
| 187 | strncat(service, server, SERVER_PART); |
| 188 | strcat(service, "\\"); |
| 189 | break; |
| 190 | |
| 191 | case sec_protocol_local: |
| 192 | service[0] = 0; |
| 193 | break; |
| 194 | |
| 195 | default: |
| 196 | isValidServer(status, 0); // let it to set the error status |
| 197 | return 0; |
| 198 | } |
| 199 | |
| 200 | return attachRemoteServiceManager(status, username, password, trusted, service, true); |
| 201 | } |
| 202 | |
| 203 | |
| 204 | /** |
no test coverage detected