| 2154 | |
| 2155 | |
| 2156 | void API_ROUTINE isc_set_login(const UCHAR** dpb, SSHORT* dpb_size) |
| 2157 | { |
| 2158 | /************************************** |
| 2159 | * |
| 2160 | * i s c _ s e t _ l o g i n |
| 2161 | * |
| 2162 | ************************************** |
| 2163 | * |
| 2164 | * Functional description |
| 2165 | * Pickup any ISC_USER and ISC_PASSWORD |
| 2166 | * environment variables, and stuff them |
| 2167 | * into the dpb (if there is no user name |
| 2168 | * or password already referenced). |
| 2169 | * |
| 2170 | **************************************/ |
| 2171 | |
| 2172 | // look for the environment variables |
| 2173 | |
| 2174 | string username, password; |
| 2175 | if (!fb_utils::readenv(ISC_USER, username) && !fb_utils::readenv(ISC_PASSWORD, password)) |
| 2176 | return; |
| 2177 | |
| 2178 | // figure out whether the username or password have already been specified |
| 2179 | |
| 2180 | bool user_seen = false, password_seen = false; |
| 2181 | |
| 2182 | if (*dpb && *dpb_size) |
| 2183 | { |
| 2184 | const UCHAR* p = *dpb; |
| 2185 | for (const UCHAR* const end_dpb = p + *dpb_size; p < end_dpb;) |
| 2186 | { |
| 2187 | const int item = *p++; |
| 2188 | switch (item) |
| 2189 | { |
| 2190 | case isc_dpb_version1: |
| 2191 | continue; |
| 2192 | |
| 2193 | case isc_dpb_user_name: |
| 2194 | user_seen = true; |
| 2195 | break; |
| 2196 | |
| 2197 | case isc_dpb_password: |
| 2198 | case isc_dpb_password_enc: |
| 2199 | password_seen = true; |
| 2200 | break; |
| 2201 | } |
| 2202 | |
| 2203 | // get the length and increment past the parameter. |
| 2204 | const USHORT l = *p++; |
| 2205 | p += l; |
| 2206 | } |
| 2207 | } |
| 2208 | |
| 2209 | if (username.length() && !user_seen) |
| 2210 | { |
| 2211 | if (password.length() && !password_seen) |
| 2212 | isc_expand_dpb_internal(dpb, dpb_size, isc_dpb_user_name, username.c_str(), |
| 2213 | isc_dpb_password, password.c_str(), 0); |
nothing calls this directly
no test coverage detected