| 1890 | |
| 1891 | |
| 1892 | IAttachment* RProvider::create(CheckStatusWrapper* status, const char* filename, |
| 1893 | unsigned int dpb_length, const unsigned char* dpb, bool loopback) |
| 1894 | { |
| 1895 | /************************************** |
| 1896 | * |
| 1897 | * g d s _ c r e a t e _ d a t a b a s e |
| 1898 | * |
| 1899 | ************************************** |
| 1900 | * |
| 1901 | * Functional description |
| 1902 | * Create a nice, squeeky clean database, uncorrupted by user data. |
| 1903 | * |
| 1904 | **************************************/ |
| 1905 | |
| 1906 | try |
| 1907 | { |
| 1908 | reset(status); |
| 1909 | |
| 1910 | ClumpletWriter newDpb(ClumpletReader::dpbList, MAX_DPB_SIZE, |
| 1911 | reinterpret_cast<const UCHAR*>(dpb), dpb_length); |
| 1912 | unsigned flags = ANALYZE_MOUNTS; |
| 1913 | |
| 1914 | if (get_new_dpb(newDpb, dpbParam, loopback)) |
| 1915 | flags |= ANALYZE_USER_VFY; |
| 1916 | |
| 1917 | if (loopback) |
| 1918 | flags |= ANALYZE_LOOPBACK; |
| 1919 | |
| 1920 | PathName expanded_name(filename); |
| 1921 | resolveAlias(filename, expanded_name, nullptr); |
| 1922 | |
| 1923 | ClntAuthBlock cBlock(&expanded_name, &newDpb, &dpbParam); |
| 1924 | PathName node_name; |
| 1925 | rem_port* port = analyze(cBlock, expanded_name, flags, newDpb, dpbParam, node_name, NULL, cryptCallback); |
| 1926 | |
| 1927 | if (!port) |
| 1928 | { |
| 1929 | Arg::Gds(isc_unavailable).copyTo(status); |
| 1930 | return NULL; |
| 1931 | } |
| 1932 | |
| 1933 | RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION); |
| 1934 | Rdb* rdb = port->port_context; |
| 1935 | |
| 1936 | // The client may have set a parameter for dummy_packet_interval. Add that to the |
| 1937 | // the DPB so the server can pay attention to it. Note: allocation code must |
| 1938 | // ensure sufficient space has been added. |
| 1939 | |
| 1940 | add_other_params(port, newDpb, dpbParam); |
| 1941 | add_working_directory(newDpb, node_name); |
| 1942 | |
| 1943 | IntlDpb intl; |
| 1944 | if (!init(status, cBlock, port, op_create, expanded_name, newDpb, intl, cryptCallback)) |
| 1945 | return NULL; |
| 1946 | |
| 1947 | IAttachment* a = FB_NEW Attachment(rdb, filename); |
| 1948 | a->addRef(); |
| 1949 | return a; |
no test coverage detected