2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
15 #include <afs\afs_cfgAdmin.h>
16 #include <afs\afs_utilAdmin.h>
18 #include <WINNT\afsapplib.h>
21 #include "hourglass.h"
24 #include "char_conv.h"
25 #include "validation.h"
28 #define ASSERT(x) _ASSERTE((x))
30 #define LOG_FILE_NAME "afs_server_config_log.txt"
33 // Enum for the steps in the wizard. Used to index into the array of steps.
50 // These are the possible states for a configuration step.
51 // The first 4 are mutually exclusive. The last one can
52 // be combined with any of the others, though it doesn't
53 // mean anything to combine it with CS_NULL.
54 #define CS_NULL 0 // NULL state
55 #define CS_DONT_CONFIGURE 1 // Do not perform the configuration step
56 #define CS_CONFIGURE 2 // Perform the configuration step
57 #define CS_ALREADY_CONFIGURED 3 // The step has already been performed, so we don't
59 #define CS_UNCONFIGURE 4 // Unconfigure the step
60 #define CS_DISABLED 32 // The step cannot be performed because it is dependent
61 // on some other step that is not to be performed and
62 // has not already been performed.
64 // I know I could have used an enum for this, but then tacking on the CS_DISABLED
65 // flag to the enum would have been a bit sleazy.
66 typedef int CONFIG_STATE;
69 #define BOSSERVER_START_TIMEOUT 2 * 60 // 2 minutes in seconds
70 #define BOSSERVER_STOP_TIMEOUT 30 * 60 // 30 minutes in seconds
72 // Sizes for various arrays
73 #define MAX_PARTITION_NAME_LEN 8 //cfg_maxPartitionNameLen
74 #define MAX_MACHINE_NAME_LEN 128 //AFS_MAX_SERVER_NAME_LEN
75 #define MAX_CELL_NAME_LEN 64
76 #define MAX_SERVER_PW_LEN 32
77 #define MAX_ADMIN_NAME_LEN 256
78 #define MAX_ADMIN_PW_LEN 32
79 #define MAX_UID_LEN 12
83 * This sturcture contains all of the information needed to configure
89 CONFIG_STATE configFS; // File server
90 CONFIG_STATE configDB; // Database server
91 CONFIG_STATE configBak; // Backup server
92 CONFIG_STATE configPartition; // Create a partition
93 CONFIG_STATE configRootVolumes; // Create root.afs and root.cell
94 CONFIG_STATE configRep; // Replicate root.afs and root.cell
95 CONFIG_STATE configSCS; // System Control server
96 CONFIG_STATE configSCC; // System Control client
100 UINT nRootAfsID; // Volume ID of root.afs
101 UINT nRootCellID; // Volume ID of root.cell
104 BOOL bRootCellExists;
106 // If we cannot determine if the root volumes exist, then this
107 // variable will be FALSE.
108 BOOL bRootVolumesExistanceKnown;
110 BOOL bRootAfsReplicated;
111 BOOL bRootCellReplicated;
112 BOOL bRootVolumesReplicationKnown;
115 TCHAR chDeviceName; // Just the drive to use
116 TCHAR szPartitionName[MAX_PARTITION_NAME_LEN + 1];
118 // Sys control machine if configuring as a system control client and also to
119 // use to propagate CellServDB, if configuring a db server
120 TCHAR szSysControlMachine[MAX_MACHINE_NAME_LEN + 1];
122 // Server and Cell information
123 TCHAR szCellName[MAX_CELL_NAME_LEN + 1];
124 TCHAR szServerPW[MAX_SERVER_PW_LEN + 1];
125 TCHAR szAdminName[MAX_ADMIN_NAME_LEN + 1];
126 TCHAR szAdminPW[MAX_ADMIN_PW_LEN + 1];
127 TCHAR szAdminUID[MAX_UID_LEN + 1];
130 BOOL bAuthServerRunning; // Only used when bFirstServer is true
131 BOOL bAdminPrincipalCreated; // Only used when bFirstServer is true
133 // This machine's local name
134 TCHAR szLocalName[MAX_MACHINE_NAME_LEN + 1];
136 // This machine's hostname
137 TCHAR szHostname[MAX_MACHINE_NAME_LEN + 1];
139 // Hostname of machine to get CellServDB from
140 TCHAR szCellServDbHostname[MAX_MACHINE_NAME_LEN + 1];
142 // Is the AFS Client configured?
143 BOOL bValidClientInfo;
144 TCHAR szClientCellName[MAX_CELL_NAME_LEN + 1];
145 unsigned nClientVersion;
147 // Does this machine have valid config info?
148 BOOL bValidServerInfo;
150 // Can we reuse the admin name and password?
151 // For use by config manager - if false we will prompt user to login.
152 BOOL bReuseAdminInfo;
154 // Handle of the thread performing a salvage
155 HANDLE hSalvageThread;
156 TCHAR szSalvageLogFileName[_MAX_PATH];
160 // Must include this after the definition of CONFIG_STATE;
161 #include "cfg_utils.h"
164 // These are defined in afscfg.cpp
165 extern LPWIZARD g_pWiz; // The wizard
166 extern LPPROPSHEET g_pSheet; // The config tool property sheet
167 extern CFG_DATA g_CfgData; // The config data
169 extern void *g_hToken; // Current token obtained by this app
170 extern void *g_hCell; // Handle to the cell we are configuring into
171 extern void *g_hClient; // Client's config library handle
172 extern void *g_hServer; // Server's config library handle
174 extern size_t g_nNumStates;
175 extern UINT g_StateDesc[]; // Res ID's of descriptions of each wizard step
177 extern LOGFILE g_LogFile; // Our log file
179 BOOL CALLBACK WizStep_Common_DlgProc (HWND hRHS, UINT msg, WPARAM wp, LPARAM lp);
180 BOOL QueryCancelWiz();
181 BOOL GetLibHandles(afs_status_t *pStatus);
182 BOOL GetHandles(HWND hParentDlg); // More convenient version if you only need to know if it succeeded
186 * Accessor functions for g_CfgData__________________________________________
190 TCHAR GetDeviceName();
191 LPTSTR GetPartitionName();
192 LPTSTR GetHostName();
193 LPTSTR GetSysControlMachine();
194 LPTSTR GetCellName();
195 LPTSTR GetServerPW();
196 LPTSTR GetAdminName();
198 LPTSTR GetAdminUID();
199 LPTSTR GetLocalName();
200 LPTSTR GetHostname();
201 LPTSTR GetCellServDbHostname();
202 LPTSTR GetClientCellName();
203 LPTSTR GetClientNetbiosName();
204 LPTSTR GetSalvageLogFileName();
207 char GetDeviceNameA();
208 char *GetPartitionNameA();
209 char *GetSysControlMachineA();
210 char *GetCellNameA();
211 char *GetServerPWA();
212 char *GetAdminNameA();
214 char *GetAdminUIDA();
215 char *GetLocalNameA();
216 char *GetHostnameA();
217 char *GetCellServDbHostnameA();
218 char *GetClientCellNameA();
219 char *GetClientNetbiosNameA();
220 char *GetSalvageLogFileNameA();
222 #endif // _H_AFSCFG_H_