| 1 | /*:VRX         Main | 
|---|
| 2 | */ | 
|---|
| 3 | /*  Main | 
|---|
| 4 | */ | 
|---|
| 5 | Main: | 
|---|
| 6 | /*  Process the arguments. | 
|---|
| 7 | Get the parent window. | 
|---|
| 8 | */ | 
|---|
| 9 | parse source . calledAs . | 
|---|
| 10 | parent = "" | 
|---|
| 11 | argCount = arg() | 
|---|
| 12 | argOff = 0 | 
|---|
| 13 | if( calledAs \= "COMMAND" )then do | 
|---|
| 14 | if argCount >= 1 then do | 
|---|
| 15 | parent = arg(1) | 
|---|
| 16 | argCount = argCount - 1 | 
|---|
| 17 | argOff = 1 | 
|---|
| 18 | end | 
|---|
| 19 | end; else do | 
|---|
| 20 | call VROptions 'ImplicitNames' | 
|---|
| 21 | call VROptions 'NoEchoQuit' | 
|---|
| 22 | end | 
|---|
| 23 | InitArgs.0 = argCount | 
|---|
| 24 | if( argCount > 0 )then do i = 1 to argCount | 
|---|
| 25 | InitArgs.i = arg( i + argOff ) | 
|---|
| 26 | end | 
|---|
| 27 | drop calledAs argCount argOff | 
|---|
| 28 |  | 
|---|
| 29 | /*  Load the windows | 
|---|
| 30 | */ | 
|---|
| 31 | call VRInit | 
|---|
| 32 | parse source . . spec | 
|---|
| 33 | _VREPrimaryWindowPath = , | 
|---|
| 34 | VRParseFileName( spec, "dpn" ) || ".VRW" | 
|---|
| 35 | _VREPrimaryWindow = , | 
|---|
| 36 | VRLoad( parent, _VREPrimaryWindowPath ) | 
|---|
| 37 | drop parent spec | 
|---|
| 38 | if( _VREPrimaryWindow == "" )then do | 
|---|
| 39 | call VRMessage "", "Cannot load window:" VRError(), , | 
|---|
| 40 | "Error!" | 
|---|
| 41 | _VREReturnValue = 32000 | 
|---|
| 42 | signal _VRELeaveMain | 
|---|
| 43 | end | 
|---|
| 44 |  | 
|---|
| 45 | /*  Process events | 
|---|
| 46 | */ | 
|---|
| 47 | call Init | 
|---|
| 48 | signal on halt | 
|---|
| 49 | do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) ) | 
|---|
| 50 | _VREEvent = VREvent() | 
|---|
| 51 | interpret _VREEvent | 
|---|
| 52 | end | 
|---|
| 53 | _VREHalt: | 
|---|
| 54 | _VREReturnValue = Fini() | 
|---|
| 55 | call VRDestroy _VREPrimaryWindow | 
|---|
| 56 | _VRELeaveMain: | 
|---|
| 57 | call VRFini | 
|---|
| 58 | exit _VREReturnValue | 
|---|
| 59 |  | 
|---|
| 60 | VRLoadSecondary: | 
|---|
| 61 | __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 ) | 
|---|
| 62 | if __vrlsWait then do | 
|---|
| 63 | call VRFlush | 
|---|
| 64 | end | 
|---|
| 65 | __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) ) | 
|---|
| 66 | if __vrlsHWnd = '' then signal __vrlsDone | 
|---|
| 67 | if __vrlsWait \= 1 then signal __vrlsDone | 
|---|
| 68 | call VRSet __vrlsHWnd, 'WindowMode', 'Modal' | 
|---|
| 69 | __vrlsTmp = __vrlsWindows.0 | 
|---|
| 70 | if( DataType(__vrlsTmp) \= 'NUM' ) then do | 
|---|
| 71 | __vrlsTmp = 1 | 
|---|
| 72 | end | 
|---|
| 73 | else do | 
|---|
| 74 | __vrlsTmp = __vrlsTmp + 1 | 
|---|
| 75 | end | 
|---|
| 76 | __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd ) | 
|---|
| 77 | __vrlsWindows.0 = __vrlsTmp | 
|---|
| 78 | do while( VRIsValidObject( VRWindow() ) = 1 ) | 
|---|
| 79 | __vrlsEvent = VREvent() | 
|---|
| 80 | interpret __vrlsEvent | 
|---|
| 81 | end | 
|---|
| 82 | __vrlsTmp = __vrlsWindows.0 | 
|---|
| 83 | __vrlsWindows.0 = __vrlsTmp - 1 | 
|---|
| 84 | call VRWindow __vrlsWindows.__vrlsTmp | 
|---|
| 85 | __vrlsHWnd = '' | 
|---|
| 86 | __vrlsDone: | 
|---|
| 87 | return __vrlsHWnd | 
|---|
| 88 |  | 
|---|
| 89 | /*:VRX         __VXREXX____APPENDS__ | 
|---|
| 90 | */ | 
|---|
| 91 | __VXREXX____APPENDS__: | 
|---|
| 92 | /* | 
|---|
| 93 | #append U:\Develop\Samba\guitools-1.0\shared\inittempdir.vrs | 
|---|
| 94 | #append U:\Develop\Samba\guitools-1.0\shared\sambainit.vrs | 
|---|
| 95 | #append U:\Develop\Samba\guitools-2.0\shared\nlv.vrs | 
|---|
| 96 | #append U:\Develop\Samba\guitools-1.0\shared\swat.vrs | 
|---|
| 97 | */ | 
|---|
| 98 | return | 
|---|
| 99 | /*:VRX         _ActiveGroup | 
|---|
| 100 | */ | 
|---|
| 101 | _ActiveGroup: | 
|---|
| 102 | ActiveGroup = translate(arg(1)) | 
|---|
| 103 | ActiveGroupObj = VRGet("GB_"ActiveGroup, "Self") | 
|---|
| 104 | ok = VRset(ActiveGroupObj, "Visible", 1) | 
|---|
| 105 | return | 
|---|
| 106 |  | 
|---|
| 107 | /*:VRX         _bs2fs | 
|---|
| 108 | */ | 
|---|
| 109 | _bs2fs: procedure | 
|---|
| 110 | string = arg(1) | 
|---|
| 111 | return translate(string,'/','\') | 
|---|
| 112 |  | 
|---|
| 113 | /*:VRX         _CfgPageSetupSize | 
|---|
| 114 | */ | 
|---|
| 115 | _CfgPageSetupSize: | 
|---|
| 116 | if arg(1) = "GB_Global" | 
|---|
| 117 | then ok = VRset(arg(1), "Top", 0) | 
|---|
| 118 | else ok = VRset(arg(1), "Top", Fwidth) | 
|---|
| 119 |  | 
|---|
| 120 | ok = VRset(arg(1), "Left",VRGet("GB_SmbConfTree","Width") + 60) | 
|---|
| 121 |  | 
|---|
| 122 | if arg(1) = "GB_Global" | 
|---|
| 123 | then ok = VRset(arg(1), "Height",VRGet("GB_SmbConfTree","height")+FWidth) | 
|---|
| 124 | else ok = VRset(arg(1), "Height",VRGet("GB_SmbConfTree","height")) | 
|---|
| 125 |  | 
|---|
| 126 | ok = VRset(arg(1), "Width", VRGet("Main", "Width") - VRGet("GB_SmbConfTree","width") - 60- FWidth*2-24*2) | 
|---|
| 127 | return | 
|---|
| 128 |  | 
|---|
| 129 | /*:VRX         _ChooseDir | 
|---|
| 130 | */ | 
|---|
| 131 | _ChooseDir: | 
|---|
| 132 | Invoked = VRInfo("Object") | 
|---|
| 133 | InitDir = VRGet("EF_"||substr(VRGet(Invoked, "name"),5),"Value") | 
|---|
| 134 | if pos('\\',InitDir) > 0 then do | 
|---|
| 135 | Msg.Text = NLVGetMessage(63,InitDir) | 
|---|
| 136 | Msg.Type = "E" | 
|---|
| 137 | call _ShowMsg | 
|---|
| 138 | return | 
|---|
| 139 | end | 
|---|
| 140 | VarPos = pos('%', InitDir) | 
|---|
| 141 | if VarPos > 0 then do | 
|---|
| 142 | VarChar = substr(InitDir,VarPos,2) | 
|---|
| 143 | InitDir = left(InitDir,VarPos-1) | 
|---|
| 144 | say VarChar | 
|---|
| 145 | end | 
|---|
| 146 | NewPath = _dirDialog('Choose path for 'VRGet("DT_Shares","Caption"),_fs2bs(InitDir)) | 
|---|
| 147 | if NewPath = "" then return | 
|---|
| 148 | if VarPos > 0 then NewPath = NewPath'\'VarChar | 
|---|
| 149 | ok = VRset("EF_"||substr(VRGet(Invoked, "name"),5),"value",NewPath) | 
|---|
| 150 | return | 
|---|
| 151 |  | 
|---|
| 152 | /*:VRX         _CreateVocObject | 
|---|
| 153 | */ | 
|---|
| 154 | _CreateVocObject: | 
|---|
| 155 | IF options.!debug == 1 THEN say "_CreateVocObject() started" | 
|---|
| 156 | If VRIsValidObject(VocObjType"_"upVoc ) then Success = 1 | 
|---|
| 157 | else do | 
|---|
| 158 | /* Creative descriptive text */ | 
|---|
| 159 | Objs = Objs + 1 | 
|---|
| 160 | Voc.V = translate(left(Voc.V,1))||substr(Voc.V,2) | 
|---|
| 161 | CreatedObjs.Objs = VRCreate(ActiveGroupObj, "DescriptiveText", "Name", "DT_"upVoc, 'Caption', Voc.V, "Top", ObjYPos+50 , "Left", 120+72, "Visible", 1, "AutoSize", 1) | 
|---|
| 162 | select | 
|---|
| 163 | when pos("\\",Val.V) > 0 then nop | 
|---|
| 164 | when pos(" dir",Voc.V) > 0 then ok = VRSet(CreatedObjs.Objs, "Forecolor", "Black") | 
|---|
| 165 | when pos("file",Voc.V) > 0 then ok = VRSet(CreatedObjs.Objs, "Forecolor", "Black") | 
|---|
| 166 | when pos("path",Voc.V) > 0 then ok = VRSet(CreatedObjs.Objs, "Forecolor", "Black") | 
|---|
| 167 | otherwise nop /* do not beautify */ | 
|---|
| 168 | end | 
|---|
| 169 |  | 
|---|
| 170 | DT_Handle = CreatedObjs.Objs | 
|---|
| 171 | /* The CB or EF */ | 
|---|
| 172 | Objs = Objs + 1 | 
|---|
| 173 | select | 
|---|
| 174 | when VocObjType = "CB" then do | 
|---|
| 175 | CreatedObjs.Objs = VRCreate(ActiveGroupObj, "Checkbox",   "Name", VocObjType"_"upVoc, "Top", ObjYPos+30, "AutoSize", 1) | 
|---|
| 176 | ok = VRSet(VocObjType"_"upVoc, "Click", "call _ShareObject_Changed") | 
|---|
| 177 | end | 
|---|
| 178 | otherwise do | 
|---|
| 179 | CreatedObjs.Objs = VRCreate(ActiveGroupObj, "EntryField", "Name", VocObjType"_"upVoc, "Top", ObjYPos   , "Width", 2800, "Height", "253") | 
|---|
| 180 | ok = VRSet(VocObjType"_"upVoc, "Change", "call _ShareObject_Changed") | 
|---|
| 181 | end | 
|---|
| 182 | end | 
|---|
| 183 | Success = (CreatedObjs.OBjs <> "") | 
|---|
| 184 | if Success then do /* SUccess */ | 
|---|
| 185 | ok = VRSet(VocObjType"_"upVoc, "Left", max(1500, 120*2+VRGet(DT_handle,"Width"))) | 
|---|
| 186 | if VocObjType = "EF" & upCurSection ="GLOBAL" then do | 
|---|
| 187 | OWidth = 2800-max(0,VRGet(VocObjType"_"upVoc, "Left")-1500) | 
|---|
| 188 | if datatype(Val.V) = "NUM" then OWidth = length(Val.V)*90+200 | 
|---|
| 189 | else OWidth = length(Val.V)*90+440 | 
|---|
| 190 | if Val.V = "" then OWidth = 1500 | 
|---|
| 191 | ok = VRSet(VocObjType"_"upVoc, "Width", OWidth) | 
|---|
| 192 | if (pos("_DIRECTORY",upVoc) > 0 | pos("_PATH",upVoc) > 0) & pos("MODE",upVoc) = 0 & pos("MASK",upVoc) = 0 then do | 
|---|
| 193 | Objs = Objs + 1 | 
|---|
| 194 | CreatedObjs.Objs = VRCreate(ActiveGroupObj, "ImagePushButton",   "Name", "IPB_"upVoc, "Top", ObjYPos+30, "AutoSize", 0 , "PicturePath", "#2;#3", "Left", VRGet(VocObjType"_"upVoc,"Left")+VRGet(VocObjType"_"upVoc,"Width")+72) | 
|---|
| 195 | ok = VRSet("IPB_"upVoc, "Click", "call _ChooseDir") | 
|---|
| 196 | ok = VRSet("IPB_"upVoc,"Width" ,VRMethod( "Screen", "PixelsToTwips", 20 )) | 
|---|
| 197 | ok = VRSet("IPB_"upVoc,"Height",VRMethod( "Screen", "PixelsToTwips", 20 )) | 
|---|
| 198 | end | 
|---|
| 199 | end | 
|---|
| 200 |  | 
|---|
| 201 | /* ok = VRSet(VocObjType"_"upVoc, "BackColor", "Red") */ | 
|---|
| 202 | ok = VRSet(VocObjType"_"upVoc, "Visible", 1) | 
|---|
| 203 | CreatedObjs.0 = Objs | 
|---|
| 204 | ObjYPos= ObjYPos + ObjDelta | 
|---|
| 205 | end | 
|---|
| 206 | else do | 
|---|
| 207 | say "Failed to Create "||VocObjType"_"upVoc||' in 'ActiveGroupObj | 
|---|
| 208 | end | 
|---|
| 209 | end | 
|---|
| 210 | IF options.!debug == 1 THEN say '  Object: "'VocObjType'_'upVoc'" Value: "'Val.V'" Handle:"'CreatedObjs.Objs'"' | 
|---|
| 211 | IF options.!debug == 1 THEN say "_CreateVocObject() done" | 
|---|
| 212 | return Success | 
|---|
| 213 | /*:VRX         _dirdialog | 
|---|
| 214 | */ | 
|---|
| 215 | _DirDialog: procedure | 
|---|
| 216 | Title   = arg(1) | 
|---|
| 217 | InitDir = arg(2) | 
|---|
| 218 | RC = RxFuncQuery("DRCtrlPickDirectory") | 
|---|
| 219 | if RC = 0 then do /* use DrCtrl if available */ | 
|---|
| 220 | MyDir=DRCtrlPickDirectory(InitDir, Title) | 
|---|
| 221 | end | 
|---|
| 222 | else do | 
|---|
| 223 | MyDir = VRFileDialog(VRWindow,Title, 'o', InitDir||'\dummy') | 
|---|
| 224 | if MyDir <> '' then MyDir = strip(filespec('D',MyDir)||Filespec('P',MyDir),'T','\') | 
|---|
| 225 | end | 
|---|
| 226 | return MyDir | 
|---|
| 227 | /*:VRX         _FindIBMLANPath | 
|---|
| 228 | */ | 
|---|
| 229 | _FindIBMLANPath: | 
|---|
| 230 | say '_FindIBMLANPath() started.' | 
|---|
| 231 | ibmlanini  = SysBootDrive()'\IBMLAN\IBMLAN.INI' | 
|---|
| 232 | ibmlaniniexists = VRFileExists(ibmlanini) | 
|---|
| 233 | say '  Does "'ibmlanini'" exist? 'ibmlaniniexists' (1=Yes, 0=No)' | 
|---|
| 234 |  | 
|---|
| 235 | lsshareini = SysBootDrive()'\IBMLAN\LSSHARE.INI' | 
|---|
| 236 | lsshareiniexists = VRFileExists(lsshareini) | 
|---|
| 237 | say '  Does "'lsshareini'" exist? 'lsshareiniexists' (1=Yes, 0=No)' | 
|---|
| 238 | say '_FindIBMLANPath() done.' | 
|---|
| 239 | return | 
|---|
| 240 |  | 
|---|
| 241 | /*:VRX         _fs2bs | 
|---|
| 242 | */ | 
|---|
| 243 | _fs2bs: procedure | 
|---|
| 244 | string = arg(1) | 
|---|
| 245 | return translate(string,'\','/') | 
|---|
| 246 |  | 
|---|
| 247 | /*:VRX         _GroupCreate | 
|---|
| 248 | */ | 
|---|
| 249 | _GroupCreate: | 
|---|
| 250 | /* Create kLIBC group file */ | 
|---|
| 251 | ok = SysFileDelete(samba.!group) | 
|---|
| 252 | call lineout samba.!group, '# Created by SSCC ver. 'word(VRGet("Main","Hinttext"),2) | 
|---|
| 253 | call lineout samba.!group, '# syntax:' | 
|---|
| 254 | call lineout samba.!group, '# groupname:password:GID:user[,user,...,]' | 
|---|
| 255 | call lineout samba.!group, 'admin:*:512:root,' | 
|---|
| 256 | call lineout samba.!group, 'users:*:513:' | 
|---|
| 257 | call lineout samba.!group, 'guests:*:514:' | 
|---|
| 258 | call lineout samba.!group, 'machines:*:515:' | 
|---|
| 259 | call lineout samba.!group, 'dc:*:516:' | 
|---|
| 260 | call lineout samba.!group, 'certadmin:*:517:' | 
|---|
| 261 | call lineout samba.!group, 'schemeadmin:*:518:' | 
|---|
| 262 | call lineout samba.!group, 'entadmin:*:519:' | 
|---|
| 263 | call lineout samba.!group, 'poladmin:*:520:' | 
|---|
| 264 | ok = stream(samba.!group,'c','close') | 
|---|
| 265 | return | 
|---|
| 266 | /*:VRX         _GUIInit | 
|---|
| 267 | */ | 
|---|
| 268 | _GUIInit: | 
|---|
| 269 | if datatype(Top) = 'NUM' then do | 
|---|
| 270 | ok = VRset("Main","Top",Top) | 
|---|
| 271 | ok = VRset("Main","Left",Left) | 
|---|
| 272 | ok = VRset("Main","Width",Width) | 
|---|
| 273 | ok = VRset("Main","Height",Height) | 
|---|
| 274 | end | 
|---|
| 275 | else ok = VRset("Main","Width", 9250) | 
|---|
| 276 |  | 
|---|
| 277 | settings.!curfcolor = VRGetIni('PM_Default_Colors', 'ActiveTitleText', 'User', 'NoClose') | 
|---|
| 278 | settings.!curbcolor = VRGetIni('PM_Default_Colors', 'ActiveTitleTextBgnd', 'User') | 
|---|
| 279 |  | 
|---|
| 280 | ok = VRSet("DT_SmbConfTree","BACKCOLOR", settings.!curbcolor ) | 
|---|
| 281 | ok = VRSet("DT_SmbConfTree","FORECOLOR", settings.!curfcolor ) | 
|---|
| 282 |  | 
|---|
| 283 | ok = VRSet("EF_Binaries_Version","value",samba.!version) | 
|---|
| 284 | ok = VRSet("EF_Binaries_Path","value",samba.!bin) | 
|---|
| 285 | ok = VRSet("EF_Scripts_Path","value",samba.!tools) | 
|---|
| 286 | ok = VRSet("EF_UnixRoot_Path","value",UnixRoot) | 
|---|
| 287 | ok = VRSet("EF_ETC_Path","value",ETC) | 
|---|
| 288 | ok = VRSet("CN_SmbConf","Caption", smbconf) | 
|---|
| 289 | ok = VRSet("IPB_ChooseDir","Width" ,VRMethod( "Screen", "PixelsToTwips", 20 )) | 
|---|
| 290 | ok = VRSet("IPB_ChooseDir","Height",VRMethod( "Screen", "PixelsToTwips", 20 )) | 
|---|
| 291 | ok = VRSet("IPB_NewItem","Width" ,VRMethod( "Screen", "PixelsToTwips", 20 )) | 
|---|
| 292 | ok = VRSet("IPB_NewItem","Height",VRMethod( "Screen", "PixelsToTwips", 20 )) | 
|---|
| 293 |  | 
|---|
| 294 | ok = VRSet("Menu_File_Import_IBMPeer", "Enabled", lsshareiniexists * ibmlaniniexists ) | 
|---|
| 295 |  | 
|---|
| 296 | ok = VRSet("Menu_Options_MiniIcons","Checked", \advanced.!bigicons) | 
|---|
| 297 | ok = VRset("CN_smbconf","MiniIcons", \advanced.!bigicons) | 
|---|
| 298 |  | 
|---|
| 299 | if _ChkTempFreeSpace() < 262144 then do | 
|---|
| 300 | Msg.Type = "W" | 
|---|
| 301 | Msg.Text = NLVGetMessage(116, TempDir) | 
|---|
| 302 | call _ShowMsg | 
|---|
| 303 | end | 
|---|
| 304 |  | 
|---|
| 305 | ok = VRSet("Menu_File_PrintCap","Enabled", \IsCupsPrintcap) | 
|---|
| 306 | if \IsCupsPrintcap then call _PrintCapCreate | 
|---|
| 307 |  | 
|---|
| 308 | if SmbConfExists then call _SmbConfLoad | 
|---|
| 309 | else ok = VRSet("TM_Installer","Enabled", 1) | 
|---|
| 310 | return | 
|---|
| 311 |  | 
|---|
| 312 | /*:VRX         _GUIInitNLV | 
|---|
| 313 | */ | 
|---|
| 314 | _GUIInitNLV: | 
|---|
| 315 | say '_GUIInitNLV started' | 
|---|
| 316 | CALL NLVSetup | 
|---|
| 317 | CALL NLVSetText 'Main', 'Caption', 1 | 
|---|
| 318 | Msg.Title = VRGet("Main", "Caption") | 
|---|
| 319 |  | 
|---|
| 320 | CALL NLVSetText 'PB_Reload',        'Caption',   11 | 
|---|
| 321 | CALL NLVSetText 'PB_Reload',        'Hinttext', 111 | 
|---|
| 322 | CALL NLVSetText 'PB_Save',        'Caption',   12 | 
|---|
| 323 | CALL NLVSetText 'PB_Save',        'Hinttext', 112 | 
|---|
| 324 | CALL NLVSetText 'PB_Undo',          'Caption',    9 | 
|---|
| 325 | CALL NLVSetText 'PB_Undo',          'Hinttext', 109 | 
|---|
| 326 | CALL NLVSetText 'PB_Cancel',        'Caption',   10 | 
|---|
| 327 | CALL NLVSetText 'PB_Cancel',        'Hinttext', 110 | 
|---|
| 328 | CALL NLVSetText 'PB_Help',          'Caption',    4 | 
|---|
| 329 | CALL NLVSetText 'PB_Help',          'Hinttext', 104 | 
|---|
| 330 | CALL NLVSetText 'PB_Add_Voc_OK',    'Caption',    2 | 
|---|
| 331 | CALL NLVSetText 'PB_Add_Voc_OK',    'Hinttext', 102 | 
|---|
| 332 | CALL NLVSetText 'PB_Add_Voc_Cancel','Caption',    3 | 
|---|
| 333 | CALL NLVSetText 'PB_Add_Voc_Cancel','Hinttext', 103 | 
|---|
| 334 | CALL NLVSetText 'Menu_File',        'Caption',   21 | 
|---|
| 335 | CALL NLVSetText 'Menu_Options',     'Caption',   22 | 
|---|
| 336 | CALL NLVSetText 'Menu_Help',        'Caption',   23 | 
|---|
| 337 |  | 
|---|
| 338 | CALL NLVSetText 'Menu_File_Import_IBMPeer', 'Caption',  24 | 
|---|
| 339 | CALL NLVSetText 'Menu_File_Reset',          'Caption',  25 | 
|---|
| 340 | CALL NLVSetText 'Menu_File_Debug',          'Caption',  26 | 
|---|
| 341 | CALL NLVSetText 'Menu_File_ImportHosts',    'Caption',  36 | 
|---|
| 342 | CALL NLVSetText 'Menu_File_PrintCap',       'Caption',  37 | 
|---|
| 343 | CALL NLVSetText 'Menu_File_SmbUpdate',      'Caption',  44 | 
|---|
| 344 | CALL NLVSetText 'Menu_File_Exit',           'Caption',  27 | 
|---|
| 345 |  | 
|---|
| 346 | CALL NLVSetText 'Menu_Options_SimpleMode',   'Caption', 28 | 
|---|
| 347 | CALL NLVSetText 'Menu_Options_ExportMode',   'Caption', 29 | 
|---|
| 348 | CALL NLVSetText 'Menu_Options_MiniIcons',    'Caption', 74 | 
|---|
| 349 | CALL NLVSetText 'Menu_Help_smbconf',         'Caption', 30 | 
|---|
| 350 | CALL NLVSetText 'Menu_Help_About',           'Caption', 31 | 
|---|
| 351 | CALL NLVSetText 'Menu_Action',               'Caption', 32 | 
|---|
| 352 | CALL NLVSetText 'Menu_Action_AddHomes',      'Caption', 33 | 
|---|
| 353 | CALL NLVSetText 'Menu_Action_AddNetlogon',   'Caption', 34 | 
|---|
| 354 | CALL NLVSetText 'Menu_Action_AddProfiles',   'Caption', 35 | 
|---|
| 355 | CALL NLVSetText 'Menu_Action_AddProfiles',   'Caption', 35 | 
|---|
| 356 | CALL NLVSetText 'Menu_Action_EraseTransient','Caption', 47 | 
|---|
| 357 |  | 
|---|
| 358 | CALL NLVSetText 'Menu_ShareContext_AddPrinter',   'Caption', 40 | 
|---|
| 359 | CALL NLVSetText 'Menu_ShareContext_Add',          'Caption', 41 | 
|---|
| 360 | CALL NLVSetText 'Menu_ShareContext_RemovePrinter','Caption', 42 | 
|---|
| 361 | CALL NLVSetText 'Menu_ShareContext_Remove',       'Caption', 43 | 
|---|
| 362 | CALL NLVSetText 'Menu_ShareContext_RenamePrinter','Caption', 48 | 
|---|
| 363 | CALL NLVSetText 'Menu_ShareContext_Rename',       'Caption', 49 | 
|---|
| 364 |  | 
|---|
| 365 | CALL NLVSetText 'DT_Help',                        'Caption', 80 | 
|---|
| 366 | CALL NLVSetText 'DT_Heading',                     'Caption', 81 | 
|---|
| 367 | CALL NLVSetText 'DT_Binaries_Version',            'Caption', 82 | 
|---|
| 368 | CALL NLVSetText 'DT_Binaries_Path',               'Caption', 83 | 
|---|
| 369 | CALL NLVSetText 'DT_Scripts_Path',                'Caption', 84 | 
|---|
| 370 | /*  CALL NLVSetText 'DT_SmbConfTree',                 'Caption', 73 */ | 
|---|
| 371 | say NLVGetMessage(73) | 
|---|
| 372 | ok = VRSet("DT_SmbConfTree","Caption", NLVGetMessage(73)) | 
|---|
| 373 | Drive = NLVGetMessage(38) | 
|---|
| 374 | say '_GUIInitNLV done' | 
|---|
| 375 | return | 
|---|
| 376 |  | 
|---|
| 377 | /*:VRX         _INIRead | 
|---|
| 378 | */ | 
|---|
| 379 | _INIRead: | 
|---|
| 380 | IF options.!debug == 1 THEN say '_INIRead() started' | 
|---|
| 381 | OurINI = strip(VRParseFileName(VRget("Application","Program"),'DP')'\SSCC.INI',,'\') | 
|---|
| 382 | ok = SysFileTree(OurINI, INIFound.,'FO') | 
|---|
| 383 | if INIFound.0 = 1 then OurINI = VRParseFileName(INIFound.1,'DPNE') | 
|---|
| 384 | say 'OurINI  ='OurINI | 
|---|
| 385 |  | 
|---|
| 386 | Top   = VRGetIni( "Pos", "Top",    OurINI , 'NoClose') | 
|---|
| 387 | Left  = VRGetIni( "Pos", "Left",   OurINI , 'NoClose') | 
|---|
| 388 | Width = VRGetIni( "Pos", "Width",  OurINI , 'NoClose') | 
|---|
| 389 | Height= VRGetIni( "Pos", "Height", OurINI , 'NoClose') | 
|---|
| 390 |  | 
|---|
| 391 | options.!debug = VRGetIni( "Options", "Debug", OurINI, 'NoClose') | 
|---|
| 392 | if options.!debug = "" then options.!debug = 0 | 
|---|
| 393 |  | 
|---|
| 394 | ok = VRSet("Menu_File_Debug","Checked",options.!Debug) | 
|---|
| 395 | if options.!Debug then ok = VRREdirectStdIO("ON") | 
|---|
| 396 | else ok = VRREdirectStdIO("OFF") | 
|---|
| 397 |  | 
|---|
| 398 | options.!builddir = VRGetIni( "Options", "BuildDir", OurINI, 'NoClose') | 
|---|
| 399 | if options.!builddir = "" then options.!builddir = "" | 
|---|
| 400 |  | 
|---|
| 401 | advanced.!bigicons = VRGetIni( "Options", "BigIcons", OurINI) | 
|---|
| 402 | if advanced.!bigicons = "" then advanced.!bigicons = 1 | 
|---|
| 403 |  | 
|---|
| 404 | /* Initialize several variables */ | 
|---|
| 405 | indent = '09'x | 
|---|
| 406 | ManageDaemons = 1 | 
|---|
| 407 |  | 
|---|
| 408 | /* these were formerly defined in smb.conf */ | 
|---|
| 409 | CreatedObjs.0 = 0 | 
|---|
| 410 | ChangeList    = "" | 
|---|
| 411 | ValueChanged  = 0 | 
|---|
| 412 | CurSection    = "" | 
|---|
| 413 | CreatedObjs.0 = 0 | 
|---|
| 414 | ActiveGroup   = "Global" | 
|---|
| 415 |  | 
|---|
| 416 | InstallMode = 0 /* Normally 0 for configure mode, /Install switch overrides this */ | 
|---|
| 417 | UseTDBSam = 0   /* only for installermode */ | 
|---|
| 418 | CreatePDC = 0   /* only for installermode */ | 
|---|
| 419 |  | 
|---|
| 420 | FWidth = 32 | 
|---|
| 421 |  | 
|---|
| 422 | IF options.!debug == 1 THEN say '_INIRead() done' | 
|---|
| 423 | return | 
|---|
| 424 |  | 
|---|
| 425 | /*:VRX         _INIWrite | 
|---|
| 426 | */ | 
|---|
| 427 | _INIWrite: | 
|---|
| 428 | ok = VRSetIni( "Pos",     "Top",      VRGet("Main","Top"),         OurINI, 'NoClose') | 
|---|
| 429 | ok = VRSetIni( "Pos",     "Left",     VRGet("Main","Left"),        OurINI, 'NoClose') | 
|---|
| 430 | ok = VRSetIni( "Pos",     "Width",    VRGet("Main","Width"),       OurINI, 'NoClose') | 
|---|
| 431 | ok = VRSetIni( "Pos",     "Height",   VRGet("Main","Height"),      OurINI, 'NoClose') | 
|---|
| 432 | ok = VRSetIni( "Options", "BuildDir", options.!builddir,           OurINI, 'NoClose') | 
|---|
| 433 | ok = VRSetIni( "Options", "Debug",    options.!debug,              OurINI, 'NoClose') | 
|---|
| 434 | ok = VRSetIni( "Options", "BigIcons", \VRGet("Menu_Options_MiniIcons","Checked"),OurINI) | 
|---|
| 435 | return | 
|---|
| 436 |  | 
|---|
| 437 | /*:VRX         _InstallerMode | 
|---|
| 438 | */ | 
|---|
| 439 | _InstallerMode: | 
|---|
| 440 | ok = VRSet("Main", "Visible", 1) | 
|---|
| 441 | window = VRLoadSecondary( "Installer", "W" ) | 
|---|
| 442 | ok = VRSet("Main", "Visible", 1) | 
|---|
| 443 | return | 
|---|
| 444 |  | 
|---|
| 445 | /*:VRX         _LMHostsImport | 
|---|
| 446 | */ | 
|---|
| 447 | _LMHostsImport: | 
|---|
| 448 | hosts = ETC'\hosts' | 
|---|
| 449 | lmhosts = ETC'\samba\lmhosts' | 
|---|
| 450 |  | 
|---|
| 451 | ok = SysFileDelete(lmhosts) | 
|---|
| 452 |  | 
|---|
| 453 | call lineout lmhosts,'# Created by SSCC ver. 'word(VRGet("Main","Hinttext"),2)' on 'date()' at 'time() | 
|---|
| 454 | call lineout lmhosts,'# Syntax:' | 
|---|
| 455 | call lineout lmhosts,'# IP-address NetBIOS-name' | 
|---|
| 456 |  | 
|---|
| 457 | do until lines(hosts) = 0 | 
|---|
| 458 | hostsline = linein(hosts) | 
|---|
| 459 | parse var hostsline IP FQDN Alias | 
|---|
| 460 | parse var FQDN hostname'.'domain | 
|---|
| 461 | if IP <> '127.0.0.1' then do | 
|---|
| 462 | say left(IP, 25)||hostname | 
|---|
| 463 | call lineout lmhosts, left(IP, 25)||hostname | 
|---|
| 464 | end | 
|---|
| 465 | end | 
|---|
| 466 |  | 
|---|
| 467 | ok = stream(hosts,'c','close') | 
|---|
| 468 | ok = stream(lmhosts,'c','close') | 
|---|
| 469 | Msg.Text = NLVGetMessage(50, lmhosts) | 
|---|
| 470 | msg.Type = 'I' | 
|---|
| 471 | call _ShowMsg | 
|---|
| 472 | return | 
|---|
| 473 |  | 
|---|
| 474 | /*:VRX         _LoadOtherFuncs | 
|---|
| 475 | */ | 
|---|
| 476 | _LoadOtherFuncs: | 
|---|
| 477 | if options.!Debug = 1 | 
|---|
| 478 | then ok = VRREdirectStdIO("ON") | 
|---|
| 479 | else ok = VRREdirectStdIO("OFF") | 
|---|
| 480 |  | 
|---|
| 481 | call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' | 
|---|
| 482 | call SysLoadFuncs | 
|---|
| 483 |  | 
|---|
| 484 | call rxfuncadd 'IniLoadFuncs', 'REXXINI', 'IniLoadFuncs' | 
|---|
| 485 | call IniLoadFuncs | 
|---|
| 486 |  | 
|---|
| 487 | call RxFuncAdd 'PRLoadFuncs',  'PR1UTIL', 'PRLoadFuncs' | 
|---|
| 488 | call PRLoadFuncs | 
|---|
| 489 |  | 
|---|
| 490 | /* Deal with DRCtrlxxx */ | 
|---|
| 491 | RC = RxFuncQuery("DRCtrlPickDirectory") | 
|---|
| 492 | if RC = 1 then do /* DRCtrlXXX not already registered */ | 
|---|
| 493 | /* Load DRCtrl functions */ | 
|---|
| 494 | ok = RxFuncAdd('DRCtrlLoadFuncs', 'drctl017', 'DRCtrlLoadFuncs') | 
|---|
| 495 | if ok = 0 then CALL DRCtrlLoadFuncs | 
|---|
| 496 | end | 
|---|
| 497 | return | 
|---|
| 498 |  | 
|---|
| 499 | /*:VRX         _MasterPasswdCreate | 
|---|
| 500 | */ | 
|---|
| 501 | _MasterPasswdCreate: | 
|---|
| 502 | call lineout samba.!masterpasswd, '# Created by SSCC ver. 'word(VRGet("Main","Hinttext"),2) | 
|---|
| 503 | call lineout samba.!masterpasswd, '# syntax:' | 
|---|
| 504 | call lineout samba.!masterpasswd, '# username:passwd:UID:GID:login-class:chg pw x sec:deact x sec:GECOS:home:shell' | 
|---|
| 505 | call lineout samba.!masterpasswd, 'root:*:0:513::0:0:root:/nonexistent:/usr/sbin/nologin' | 
|---|
| 506 | call lineout samba.!masterpasswd, 'guest:*:65534:65534::0:0:guest:/nonexistent:/usr/sbin/nologin' | 
|---|
| 507 | ok = stream(samba.!masterpasswd,'c','close') | 
|---|
| 508 | return | 
|---|
| 509 |  | 
|---|
| 510 | /*:VRX         _MsgYesNo | 
|---|
| 511 | */ | 
|---|
| 512 | _MsgYesNo: | 
|---|
| 513 | IF options.!debug == 1 THEN say '_MsgYesNo() started' | 
|---|
| 514 | IF options.!debug == 1 THEN say '  Msgbox:"'Msg.Text'"' | 
|---|
| 515 | buttons.0 = 2 | 
|---|
| 516 | buttons.1 = NLVGetMessage('6') | 
|---|
| 517 | buttons.2 = NLVGetMessage('7') | 
|---|
| 518 | default = 2 | 
|---|
| 519 | buttons.default = buttons.2 | 
|---|
| 520 | esc = 2 | 
|---|
| 521 | buttons.esc = buttons.2 | 
|---|
| 522 | RC = VRMessage( VRWindow(), Msg.Text, Msg.Title,"Q","buttons.",default, esc ) | 
|---|
| 523 | IF options.!debug == 1 THEN say '  Answer: 'RC' ( 1 = Yes, 2 = No)' | 
|---|
| 524 | IF options.!debug == 1 THEN say '_MsgYesNo() done' | 
|---|
| 525 | return RC | 
|---|
| 526 |  | 
|---|
| 527 | /*:VRX         _MyIniEnum | 
|---|
| 528 | */ | 
|---|
| 529 | _MyIniEnum: procedure expose sections. Voc. Val. | 
|---|
| 530 | CurSection = arg(1) | 
|---|
| 531 | do I = 1 to sections.0 | 
|---|
| 532 | say I':'sections.I | 
|---|
| 533 | if sections.I = Cursection then leave | 
|---|
| 534 | end | 
|---|
| 535 | if I <= sections.0 then do | 
|---|
| 536 | say 'sections.'I'.0='sections.I.0 | 
|---|
| 537 | Voc.0 = sections.I.0 | 
|---|
| 538 | Val.0 = sections.I.0 | 
|---|
| 539 | do J = 1 to Voc.0 | 
|---|
| 540 | parse var sections.I.J Voc.J'='Val.J | 
|---|
| 541 | Voc.J = strip(Voc.J) | 
|---|
| 542 | Val.J = strip(Val.J) | 
|---|
| 543 | end | 
|---|
| 544 | end | 
|---|
| 545 | return | 
|---|
| 546 |  | 
|---|
| 547 | /*:VRX         _MyIniEnumSections | 
|---|
| 548 | */ | 
|---|
| 549 | _MyIniEnumSections: procedure expose sections. | 
|---|
| 550 | say '_MyIniEnumSections() started' | 
|---|
| 551 | smbconf = arg(1) | 
|---|
| 552 | sections. = "" | 
|---|
| 553 | I = 0 | 
|---|
| 554 | J = 0 | 
|---|
| 555 | do until lines(smbconf) = 0 | 
|---|
| 556 | smbconfline = strip(translate(linein(smbconf),' ','09'x)) | 
|---|
| 557 | select | 
|---|
| 558 | when left(smbconfline,1) =' ' then nop /* empty line */ | 
|---|
| 559 | when left(smbconfline,1) =';' then nop /* Comment */ | 
|---|
| 560 | when left(smbconfline,1) ='#' then nop /* Comment */ | 
|---|
| 561 | when left(smbconfline,1) ='[' then do  /* Section */ | 
|---|
| 562 | sections.I.0 = J | 
|---|
| 563 | I = I + 1 | 
|---|
| 564 | J = 0 | 
|---|
| 565 | parse var smbconfline '['CurSection']' | 
|---|
| 566 | sections.I = CurSection | 
|---|
| 567 | say '  'CurSection | 
|---|
| 568 | end | 
|---|
| 569 | otherwise do /* Option */ | 
|---|
| 570 | parse var smbconfline option'='value | 
|---|
| 571 | J = J + 1 | 
|---|
| 572 | sections.I.J = smbconfline | 
|---|
| 573 | option = translate(strip(option),'_!?',' :$') | 
|---|
| 574 | value  = strip(value) | 
|---|
| 575 | OptStr = CurSection'.'option'="'Value'"' | 
|---|
| 576 | /* say OptStr */ | 
|---|
| 577 | end | 
|---|
| 578 | end | 
|---|
| 579 | end | 
|---|
| 580 | sections.0 = I | 
|---|
| 581 | sections.I.0 = J | 
|---|
| 582 | ok = stream(smbconf,'c','close') | 
|---|
| 583 | say '_MyIniEnumSections() done.' | 
|---|
| 584 | return | 
|---|
| 585 |  | 
|---|
| 586 | /*:VRX         _NLVSetup | 
|---|
| 587 | */ | 
|---|
| 588 | _NLVSetup: | 
|---|
| 589 | call NLVSetup | 
|---|
| 590 | RETURN | 
|---|
| 591 | /*:VRX         _ParseCommandLine | 
|---|
| 592 | */ | 
|---|
| 593 | _ParseCommandLine: | 
|---|
| 594 | IF options.!debug == 1 THEN SAY "_ParseCommandLine() started" | 
|---|
| 595 | CmdLine = VRGet("Application","Commandline") | 
|---|
| 596 | IF options.!debug == 1 THEN SAY '  original commandline ="'CmdLine'"' | 
|---|
| 597 | upCmdLine = translate(CmdLine) | 
|---|
| 598 |  | 
|---|
| 599 | InstPos = pos('/INSTALL',upCmdLine) | 
|---|
| 600 |  | 
|---|
| 601 | if InstPos > 0 then do | 
|---|
| 602 | IF options.!debug == 1 THEN SAY "  /install switch detected" | 
|---|
| 603 | InstallMode = 1 | 
|---|
| 604 | end | 
|---|
| 605 | IF options.!debug == 1 THEN SAY "_ParseCommandLine() done" | 
|---|
| 606 | return | 
|---|
| 607 |  | 
|---|
| 608 | /*:VRX         _PrintCapCreate | 
|---|
| 609 | */ | 
|---|
| 610 | _PrintCapCreate: | 
|---|
| 611 | ok = SysFileDelete(samba.!printcap) | 
|---|
| 612 | ok = SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', 'ALL:','printers.') | 
|---|
| 613 | call lineout samba.!printcap, '# Created by SSCC ver. 'word(VRGet("Main","Hinttext"),2)' on 'date()' at 'time() | 
|---|
| 614 | call lineout samba.!printcap, '# syntax:' | 
|---|
| 615 | call lineout samba.!printcap, '# Printerqueue|printername' | 
|---|
| 616 | do I = 1 to printers.0 | 
|---|
| 617 | queue = printers.I | 
|---|
| 618 | name = strip(strip(SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', printers.I),'T','00'x),,';') | 
|---|
| 619 | call lineout samba.!printcap, queue'|'name | 
|---|
| 620 | end | 
|---|
| 621 | ok = stream(samba.!printcap,'c','close') | 
|---|
| 622 | return | 
|---|
| 623 |  | 
|---|
| 624 | /*:VRX         _SambaCheckComponents | 
|---|
| 625 | */ | 
|---|
| 626 | _SambaCheckComponents: | 
|---|
| 627 | IF options.!debug == 1 THEN say '_SambaCheckComponents() started' | 
|---|
| 628 |  | 
|---|
| 629 | /* set deprecated variables */ | 
|---|
| 630 | smbconf = samba.!smbconf | 
|---|
| 631 | printcap = samba.!printcap | 
|---|
| 632 |  | 
|---|
| 633 | /* detect presence of several components and act accordingly */ | 
|---|
| 634 | SmbConfExists = VRFileExists(samba.!smbconf) | 
|---|
| 635 | IF options.!debug == 1 THEN say '  Does "'smbconf'" exist? 'SmbConfExists' (1=Yes, 0=No)' | 
|---|
| 636 |  | 
|---|
| 637 | IsCupsPrintcap = 0 | 
|---|
| 638 | if VRFileExists(samba.!printcap) then do | 
|---|
| 639 | printcapline = translate(linein(samba.!printcap)) | 
|---|
| 640 | if pos("CUPS",printcapline) > 0 then IsCupsPrintcap = 1 | 
|---|
| 641 | ok = stream(samba.!printcap,'c','close') | 
|---|
| 642 | end | 
|---|
| 643 | IF options.!debug == 1 THEN say '  Is printcap from CUPS? 'IsCupsPrintcap' (1=Yes, 0=No)' | 
|---|
| 644 |  | 
|---|
| 645 | if \VRFileExists(samba.!smbcmd) then do | 
|---|
| 646 | Msg.Title = NLVGetMessage('1') | 
|---|
| 647 | Msg.Type = "E" | 
|---|
| 648 | Msg.Text = NLVGetMessage(53, samba.!smbcmd)' - 'NLVGetMessage(55) | 
|---|
| 649 | call _ShowMsg | 
|---|
| 650 | ManageDaemons = 0 | 
|---|
| 651 | end | 
|---|
| 652 | IF options.!debug == 1 THEN say '  Is "'samba.!smbcmd'" present, able to manage daemons = 'ManageDaemons' (1=Yes, 0=No)' | 
|---|
| 653 |  | 
|---|
| 654 | if \VRFileExists(samba.!testparmexe) then do | 
|---|
| 655 | Msg.Title = NLVGetMessage('1') | 
|---|
| 656 | Msg.Text  = NLVGetMessage(53,samba.!testparmexe)' - 'NLVGetMessage(54) | 
|---|
| 657 | Msg.Type  = "E" | 
|---|
| 658 | call _ShowMsg | 
|---|
| 659 | call Quit | 
|---|
| 660 | end | 
|---|
| 661 | IF options.!debug == 1 THEN say '  Is "'samba.!testparmexe'" present, continuing.' | 
|---|
| 662 |  | 
|---|
| 663 | if \VRFileExists(samba.!smbpasswdexe) then do | 
|---|
| 664 | Msg.Title = NLVGetMessage('1') | 
|---|
| 665 | Msg.Text  = NLVGetMessage(53,samba.!smbpasswdexe)' - 'NLVGetMessage(54) | 
|---|
| 666 | Msg.Type  = "E" | 
|---|
| 667 | call _ShowMsg | 
|---|
| 668 | call Quit | 
|---|
| 669 | end | 
|---|
| 670 | IF options.!debug == 1 THEN say '  Is "'samba.!smbpasswdexe'" is present, continuing.' | 
|---|
| 671 |  | 
|---|
| 672 | if SmbConfExists then do | 
|---|
| 673 | call _SmbConfBackup | 
|---|
| 674 | if InstallMode then do | 
|---|
| 675 | window = VRLoadSecondary( "RemoveConfig", "W" ) | 
|---|
| 676 | end | 
|---|
| 677 | end | 
|---|
| 678 |  | 
|---|
| 679 | if \VRFileExists(swatusers) & swatauth = 1 & InstallMode = 0 then do | 
|---|
| 680 | Msg.Text = NLVGetMessage(115, swatusers) | 
|---|
| 681 | Msg.Type = "W" | 
|---|
| 682 | call _ShowMsg | 
|---|
| 683 | end | 
|---|
| 684 | IF options.!debug == 1 THEN say '  Does "'samba.!smbconf'" still exist? 'SmbConfExists' (1=Yes, 0=No)' | 
|---|
| 685 | IF options.!debug == 1 THEN say '  Running in InstallMode = 'InstallMode' (1=Yes, 0=No)' | 
|---|
| 686 |  | 
|---|
| 687 | IF options.!debug == 1 THEN say '_SambaCheckComponents() done' | 
|---|
| 688 | return | 
|---|
| 689 |  | 
|---|
| 690 |  | 
|---|
| 691 | /*          Msg.Text = NLVGetMessage(56, samba.!smbconf) | 
|---|
| 692 | Msg.Type = "Q" | 
|---|
| 693 | ok = _MsgYesNo() | 
|---|
| 694 | if ok = 1 then do | 
|---|
| 695 | ok = SysFileDelete(samba.!smbconf) | 
|---|
| 696 | SmbConfExists = 0 | 
|---|
| 697 | Msg.Text = "Also reinitialize backend?" /* NLVGetMessage(56, samba.!smbconf) */ | 
|---|
| 698 | Msg.Type = "Q" | 
|---|
| 699 | ok = _MsgYesNo() | 
|---|
| 700 | if ok = 1 then do | 
|---|
| 701 | ok = SysFileTree(ETC"\samba\*.?db",xdb.,'FOS') | 
|---|
| 702 | do I = 1 to xdb.0 | 
|---|
| 703 | ok = SysFileDelete(xdb.I) | 
|---|
| 704 | if ok <> 0 then do | 
|---|
| 705 | Msg.Text = "Error "ok" deleting "xdb.I"!" | 
|---|
| 706 | Msg.Type = "W" | 
|---|
| 707 | call _ShowMsg | 
|---|
| 708 | end | 
|---|
| 709 | end | 
|---|
| 710 | end | 
|---|
| 711 | end | 
|---|
| 712 | else InstallMode = 0 | 
|---|
| 713 | */ | 
|---|
| 714 | /*:VRX         _SambaGroupMapInst | 
|---|
| 715 | */ | 
|---|
| 716 | _SambaGroupMapInst: | 
|---|
| 717 | IF options.!debug == 1 THEN SAY "_SambaGroupMapInst() started" | 
|---|
| 718 | /* These group mappings are obligatory */ | 
|---|
| 719 | IF options.!debug == 1 THEN SAY  "  Mapping Required domain groups" | 
|---|
| 720 | address cmd samba.!netexe' groupmap add rid=512 ntgroup="Domain Admins"                unixgroup="admin"       type=domain   comment="Domain Administrators"' | 
|---|
| 721 | address cmd samba.!netexe' groupmap add rid=513 ntgroup="Domain Users"                 unixgroup="users"       type=domain   comment="Domain Users"' | 
|---|
| 722 | address cmd samba.!netexe' groupmap add rid=514 ntgroup="Domain Guests"                unixgroup="guests"      type=domain   comment="Domain Guests"' | 
|---|
| 723 |  | 
|---|
| 724 | /* These group mappings are optional */ | 
|---|
| 725 | IF options.!debug == 1 THEN SAY "  Mapping Optional domain groups" | 
|---|
| 726 | address cmd samba.!netexe' groupmap add rid=515 ntgroup="Domain Computers"             unixgroup="machines"    type=domain   comment="Domain Computers"' | 
|---|
| 727 | address cmd samba.!netexe' groupmap add rid=516 ntgroup="Domain Controllers"           unixgroup="dc"          type=domain   comment="Domain Controllers"' | 
|---|
| 728 | address cmd samba.!netexe' groupmap add rid=517 ntgroup="Domain Certificate Admins"    unixgroup="certadmin"   type=domain   comment="Domain Certificate Administrators"' | 
|---|
| 729 | address cmd samba.!netexe' groupmap add rid=518 ntgroup="Domain Schema Admins"         unixgroup="schemeadmin" type=domain   comment="Domain Schema Administrators"' | 
|---|
| 730 | address cmd samba.!netexe' groupmap add rid=519 ntgroup="Domain Enterprise Admins"     unixgroup="entadmin"    type=domain   comment="Domain Enterprise Administrators"' | 
|---|
| 731 | address cmd samba.!netexe' groupmap add rid=520 ntgroup="Domain Policy Admins"         unixgroup="poladmin"    type=domain   comment="Domain Policy Administrators"' | 
|---|
| 732 |  | 
|---|
| 733 | /* The following ones are unsupported at the moment - use at your own risk */ | 
|---|
| 734 | /* | 
|---|
| 735 | IF options.!debug == 1 THEN SAY say "  Mapping Builtin groups" | 
|---|
| 736 | address cmd samba.!netexe' groupmap add rid=544 ntgroup="Builtin Admins"               unixgroup="ntadmin"   type=builtin | 
|---|
| 737 | address cmd samba.!netexe' groupmap add rid=545 ntgroup="Builtin Users"                unixgroup="ntusers"   type=builtin | 
|---|
| 738 | address cmd samba.!netexe' groupmap add rid=546 ntgroup="Builtin Guests"               unixgroup="ntguests"  type=builtin | 
|---|
| 739 | address cmd samba.!netexe' groupmap add rid=547 ntgroup="Builtin Power Users"          unixgroup="" type=builtin | 
|---|
| 740 | address cmd samba.!netexe' groupmap add rid=548 ntgroup="Builtin Account Operators"    unixgroup="" type=builtin | 
|---|
| 741 | address cmd samba.!netexe' groupmap add rid=549 ntgroup="Builtin System Operators"     unixgroup="operator" type=builtin | 
|---|
| 742 | address cmd samba.!netexe' groupmap add rid=550 ntgroup="Builtin Print Operators"      unixgroup="lp" type=builtin | 
|---|
| 743 | address cmd samba.!netexe' groupmap add rid=551 ntgroup="Builtin Backup Operators"     unixgroup="backup" type=builtin | 
|---|
| 744 | address cmd samba.!netexe' groupmap add rid=552 ntgroup="Builtin Replicator"           unixgroup="" type=builtin | 
|---|
| 745 | address cmd samba.!netexe' groupmap add rid=553 ntgroup="Builtin RAS Servers"          unixgroup="" type=builtin | 
|---|
| 746 | */ | 
|---|
| 747 | IF options.!debug == 1 THEN SAY "_SambaGroupMapInst() done" | 
|---|
| 748 | return | 
|---|
| 749 |  | 
|---|
| 750 | /*:VRX         _SambaGuestCreate | 
|---|
| 751 | */ | 
|---|
| 752 | _SambaGuestCreate: | 
|---|
| 753 | IF options.!debug == 1 THEN say "_SambaGuestCreate() started" | 
|---|
| 754 | IF options.!debug == 1 THEN say '  'samba.!smbpasswdexe' -a guest -n' | 
|---|
| 755 | samba.!smbpasswdexe' -a guest -n -D 0 2>'samba.!error' 1>'samba.!message | 
|---|
| 756 |  | 
|---|
| 757 | if rc = 0 then call _SambaShowMsg | 
|---|
| 758 | else call _SambaShowError | 
|---|
| 759 |  | 
|---|
| 760 | IF options.!debug == 1 THEN say "_SambaGuestCreate() done" | 
|---|
| 761 | return | 
|---|
| 762 |  | 
|---|
| 763 | /*:VRX         _SambaRootPWCheck | 
|---|
| 764 | */ | 
|---|
| 765 | _SambaRootPWCheck: | 
|---|
| 766 | if VRGet("EF_RootPassword","Value") ="" then do | 
|---|
| 767 | Msg.type  = "E" | 
|---|
| 768 | Msg.Text  = NLVGetMessage(57, "root") | 
|---|
| 769 | call _ShowMsg | 
|---|
| 770 | return 0 | 
|---|
| 771 | end | 
|---|
| 772 | if VRGet("EF_RootPassword_repeat","Value") ="" then do | 
|---|
| 773 | Msg.type  = "E" | 
|---|
| 774 | Msg.Text  = NLVGetMessage(58,"root") | 
|---|
| 775 | call _ShowMsg | 
|---|
| 776 | return 0 | 
|---|
| 777 | end | 
|---|
| 778 |  | 
|---|
| 779 | if VRGet("EF_RootPassword","Value") <> VRGet("EF_RootPassword_repeat","Value") then do | 
|---|
| 780 | Msg.type  = "E" | 
|---|
| 781 | Msg.Text  = NLVGetMessage(59, "root") | 
|---|
| 782 | call _ShowMsg | 
|---|
| 783 | return 0 | 
|---|
| 784 | end | 
|---|
| 785 | return 1 | 
|---|
| 786 |  | 
|---|
| 787 | /*:VRX         _SambaRootPWSet | 
|---|
| 788 | */ | 
|---|
| 789 | _SambaRootPWSet: | 
|---|
| 790 | IF options.!debug == 1 THEN say "_SambaRootPWSet() started" | 
|---|
| 791 |  | 
|---|
| 792 | /* Write root password to a temp file */ | 
|---|
| 793 | pwdfile = TempDir'newpwd' | 
|---|
| 794 | call lineout pwdfile, VRGet("EF_RootPassword","value") | 
|---|
| 795 | call lineout pwdfile, VRGet("EF_RootPassword","value") | 
|---|
| 796 | ok = stream(pwdfile,"c","close") | 
|---|
| 797 |  | 
|---|
| 798 | /* Create the root account */ | 
|---|
| 799 | IF options.!debug == 1 THEN say '  'samba.!smbpasswdexe' -a root -s <'pwdfile | 
|---|
| 800 | samba.!smbpasswdexe' -a root -s -D 0 <'pwdfile' 2>'samba.!error' 1>'samba.!message | 
|---|
| 801 |  | 
|---|
| 802 | if rc = 0 then call _SambaShowMsg | 
|---|
| 803 | else call _SambaShowError | 
|---|
| 804 |  | 
|---|
| 805 | /* Remove the temp password file */ | 
|---|
| 806 | ok = SysFileDelete(pwdfile) | 
|---|
| 807 |  | 
|---|
| 808 | /* Deal with swat */ | 
|---|
| 809 | /* FixMe: We do not need htpasswd.exe anymore as we use rxcrypt.dll */ | 
|---|
| 810 | if swatauth then do | 
|---|
| 811 | /* we always remove the old swat */ | 
|---|
| 812 | say '  'samba.!htpasswdexe' -D "'swatusers'" root' | 
|---|
| 813 | address cmd samba.!htpasswdexe' -D "'swatusers'" root' /* ' 2>'samba.!error' 1>'samba.!msg | 
|---|
| 814 | if rc <> 0 then call _SambaShowError; else call _SambaShowMsg  */ | 
|---|
| 815 |  | 
|---|
| 816 | if VRFileExists(swatusers) then cFlag = ""; else cFlag="c" | 
|---|
| 817 | say '  'samba.!htpasswdexe' -b'cFLag' "'swatusers'" root **********' | 
|---|
| 818 | address cmd samba.!htpasswdexe' -b'cFlag' "'swatusers'" root 'VRGet("EF_RootPassword","value") /* ' 2>'samba.!error' 1>'samba.!msg | 
|---|
| 819 | if rc <> 0 then call _SambaShowError | 
|---|
| 820 | else call _SambaShowMsg */ | 
|---|
| 821 | end | 
|---|
| 822 | IF options.!debug == 1 THEN say "_SambaRootPWSet() done" | 
|---|
| 823 | return | 
|---|
| 824 |  | 
|---|
| 825 | /*:VRX         _SambaShowError | 
|---|
| 826 | */ | 
|---|
| 827 | _SambaShowError: procedure expose samba. settings. options. | 
|---|
| 828 | I = 0 | 
|---|
| 829 | do while lines(samba.!error) <> 0 | 
|---|
| 830 | I = I + 1 | 
|---|
| 831 | smberr.I = linein(samba.!error) | 
|---|
| 832 | say I':err:'smberr.I | 
|---|
| 833 | end | 
|---|
| 834 | ok = stream(Samba.!error,"c","close") | 
|---|
| 835 | ok = SysFileDelete(Samba.!error) | 
|---|
| 836 | smberr.0 = I | 
|---|
| 837 | /* we did not get any error text */ | 
|---|
| 838 | if smberr.0 = 0 then return | 
|---|
| 839 | Buttons.1 = "OK" | 
|---|
| 840 | Buttons.0 = 1 | 
|---|
| 841 | id = VRMessageStem( VRWindow(), "smberr.", VRGet("Main", "Caption") , "Error", "Buttons.", buttons.1, buttons.1 ) | 
|---|
| 842 | return | 
|---|
| 843 |  | 
|---|
| 844 | /*:VRX         _SambaShowMsg | 
|---|
| 845 | */ | 
|---|
| 846 | _SambaShowMsg: procedure expose samba. settings. options. | 
|---|
| 847 | I = 0 | 
|---|
| 848 | do while lines(samba.!message) <> 0 | 
|---|
| 849 | I = I + 1 | 
|---|
| 850 | smbmsg.I = linein(samba.!message) | 
|---|
| 851 | say I':msg:'smbmsg.I | 
|---|
| 852 | end | 
|---|
| 853 | ok = stream(Samba.!message,"c","close") | 
|---|
| 854 | ok = SysFileDelete(Samba.!message) | 
|---|
| 855 | smbmsg.0 = I | 
|---|
| 856 | /* we did not get any message */ | 
|---|
| 857 | if smbmsg.0 = 0 then return | 
|---|
| 858 | Buttons.1 = "OK" | 
|---|
| 859 | Buttons.0 = 1 | 
|---|
| 860 | id = VRMessageStem( VRWindow(), "smbmsg.", VRGet("Main", "Caption") , "I", "Buttons.", buttons.1, buttons.1 ) | 
|---|
| 861 | return | 
|---|
| 862 | /*:VRX         _SambaUserCreate | 
|---|
| 863 | */ | 
|---|
| 864 | _SambaUserCreate: | 
|---|
| 865 | eCSUser = value("USER",,"OS2ENVIRONMENT") | 
|---|
| 866 | if translate(eCSUser) <> "root" & translate(eCSUser) <> "guest" then do | 
|---|
| 867 | Msg.Text = NLVGetMessage(75, eCSUser) | 
|---|
| 868 | Msg.Type = "I" | 
|---|
| 869 | call _ShowMsg | 
|---|
| 870 | end | 
|---|
| 871 | return | 
|---|
| 872 |  | 
|---|
| 873 | /*:VRX         _SambaVersion | 
|---|
| 874 | */ | 
|---|
| 875 | _SambaVersion: | 
|---|
| 876 | say "_SambaVersion() started" | 
|---|
| 877 | address cmd samba.!smbd' -V >'samba.!msg | 
|---|
| 878 | samba.!version = linein(samba.!msg) | 
|---|
| 879 | say "  Samba "samba.!version | 
|---|
| 880 | ok = stream(samba.!msg,"c","close") | 
|---|
| 881 | say "_SambaVersion() done" | 
|---|
| 882 | return | 
|---|
| 883 |  | 
|---|
| 884 | /*:VRX         _SaveChanges | 
|---|
| 885 | */ | 
|---|
| 886 | _SaveChanges: | 
|---|
| 887 | say '_SaveChanges() started for ['CurSection']' | 
|---|
| 888 |  | 
|---|
| 889 | do I = 1 to words(ChangeList) | 
|---|
| 890 | ChangeObj = word(ChangeList,I) | 
|---|
| 891 | say "Changed object: "ChangeObj | 
|---|
| 892 |  | 
|---|
| 893 | parse var ChangeObj ChangeObjType '_' ChangeVoc | 
|---|
| 894 |  | 
|---|
| 895 | ChangeVoc = translate(ChangeVoc, ' ', '_') | 
|---|
| 896 | say "Changed voc: "ChangeVoc | 
|---|
| 897 | VocIdx = VRGet(ChangeObj,'Userdata') | 
|---|
| 898 | if ChangeObjType = "EF" then do | 
|---|
| 899 |  | 
|---|
| 900 | NewVal = VRGet(ChangeObj, 'Value') | 
|---|
| 901 | parse var sections.CurSIdx.VocIdx OldVoc'='OldVal | 
|---|
| 902 | OldVoc = strip(oldVoc) | 
|---|
| 903 | sections.CurSIdx.VocIdx = OldVoc' = 'NewVal | 
|---|
| 904 |  | 
|---|
| 905 | if VRGet(ChangeObj, 'Value') <> "" then do | 
|---|
| 906 | select | 
|---|
| 907 | when pos("\\", VRGet(ChangeObj, 'Value')) > 0 then ok = IniSet(ChangeVoc, VRGet(ChangeObj, 'Value'), CurSection, samba.!smbconf) | 
|---|
| 908 | when pos(" dir",   ChangeVoc) > 0 then ok = IniSet(ChangeVoc, _bs2fs(VRGet(ChangeObj, 'Value')), CurSection, samba.!smbconf) | 
|---|
| 909 | when pos("file",   ChangeVoc) > 0 then ok = IniSet(ChangeVoc, _bs2fs(VRGet(ChangeObj, 'Value')), CurSection, samba.!smbconf) | 
|---|
| 910 | when pos("path",   ChangeVoc) > 0 then ok = IniSet(ChangeVoc, _bs2fs(VRGet(ChangeObj, 'Value')), CurSection, samba.!smbconf) | 
|---|
| 911 | /*                  when pos("command",ChangeVoc) > 0 then ok = IniSet(ChangeVoc, _bs2fs(VRGet(ChangeObj, 'Value')), CurSection, samba.!smbconf) */ | 
|---|
| 912 | /*                  when pos("script", ChangeVoc) > 0 then ok = IniSet(ChangeVoc, _bs2fs(VRGet(ChangeObj, 'Value')), CurSection, samba.!smbconf) */ | 
|---|
| 913 | otherwise ok = IniSet(ChangeVoc, VRGet(ChangeObj, 'Value'), CurSection, samba.!smbconf) | 
|---|
| 914 | end | 
|---|
| 915 | say "INISet ok = "ok | 
|---|
| 916 | end | 
|---|
| 917 | else do | 
|---|
| 918 | ok = IniDel( ChangeVoc, CurSection, samba.!smbconf ) | 
|---|
| 919 | say "INIDel ok = "ok | 
|---|
| 920 | if ok = "" then ok = 0 | 
|---|
| 921 | end | 
|---|
| 922 | end | 
|---|
| 923 | if ChangeObjType = "CB" then do | 
|---|
| 924 | If VRGet(ChangeObj, 'Set') then BoolVal = "Yes"; else BoolVal = "No" | 
|---|
| 925 |  | 
|---|
| 926 | parse var sections.CurSIdx.VocIdx OldVoc'='OldVal | 
|---|
| 927 | OldVoc = strip(oldVoc) | 
|---|
| 928 | sections.CurSIdx.VocIdx = OldVoc' = 'BoolVal | 
|---|
| 929 |  | 
|---|
| 930 | ok = IniSet(ChangeVoc, BoolVal, CurSection, samba.!smbconf) | 
|---|
| 931 | say "INISet ok = "ok" (Bool)" | 
|---|
| 932 | end | 
|---|
| 933 | end | 
|---|
| 934 |  | 
|---|
| 935 | if ok = 0 then do | 
|---|
| 936 | Msg.Type = "I" | 
|---|
| 937 | Msg.Text = NLVGetMessage(51) | 
|---|
| 938 | end | 
|---|
| 939 | else do | 
|---|
| 940 | Msg.Type = "E" | 
|---|
| 941 | Msg.Text = NLVGetMessage(52) | 
|---|
| 942 | end | 
|---|
| 943 | call _ShowMsg | 
|---|
| 944 |  | 
|---|
| 945 | call TM_Value_Trigger | 
|---|
| 946 |  | 
|---|
| 947 | say '_SaveChanges() done' | 
|---|
| 948 | return | 
|---|
| 949 | /*:VRX         _ShareObject_Changed | 
|---|
| 950 | */ | 
|---|
| 951 | _ShareObject_Changed: | 
|---|
| 952 | say "_ShareObject_Changed() started" | 
|---|
| 953 | ValueChanged = 1 | 
|---|
| 954 | if pos(VRGet(VRInfo("OBject"),"Name"), ChangeList) = 0 then Changelist = ChangeList' 'VRGet(VRInfo("OBject"),"Name") | 
|---|
| 955 | ok = VRSet("PB_Save", "Enabled", 1) | 
|---|
| 956 | say "  ValueChanged = "ValueChanged | 
|---|
| 957 | say Changelist | 
|---|
| 958 | say "_ShareObject_Changed() done" | 
|---|
| 959 | return | 
|---|
| 960 |  | 
|---|
| 961 | /*:VRX         _SharesReset | 
|---|
| 962 | */ | 
|---|
| 963 | _SharesReset: | 
|---|
| 964 | say '_SharesReset started' | 
|---|
| 965 | ok = VRset("EF_path", "Value","") | 
|---|
| 966 | ok = VRFlush( , "EF_path" ) | 
|---|
| 967 | ok = VRset("CB_Browseable", "Set", 1) | 
|---|
| 968 | ok = VRFlush( , "CB_Browseable" ) | 
|---|
| 969 | ok = VRset("CB_Read_Only",  "Set", 0) | 
|---|
| 970 | ok = VRFlush( , "CB_Read_Only") | 
|---|
| 971 | ok = VRset("CB_Guest_OK",   "Set", 0) | 
|---|
| 972 | ok = VRFlush( , "CB_Guest_OK" ) | 
|---|
| 973 | do I = 1 to CreatedObjs.0 | 
|---|
| 974 | ok = VRDestroy(CreatedObjs.I) | 
|---|
| 975 | end | 
|---|
| 976 | say '_SharesReset done' | 
|---|
| 977 | return | 
|---|
| 978 |  | 
|---|
| 979 | /*:VRX         _ShowMsg | 
|---|
| 980 | */ | 
|---|
| 981 | _ShowMsg: | 
|---|
| 982 | Buttons.1 = "OK" | 
|---|
| 983 | Buttons.0 = 1 | 
|---|
| 984 | id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 ) | 
|---|
| 985 | return | 
|---|
| 986 |  | 
|---|
| 987 | /*:VRX         _Smb35Init | 
|---|
| 988 | */ | 
|---|
| 989 | _Smb35Init: | 
|---|
| 990 | IF options.!debug == 1 THEN say '_Smb35Init() started' | 
|---|
| 991 | say '1 -> 'samba.!smbpasswdexe' -a dummyuser -n -D 10' | 
|---|
| 992 | address cmd samba.!smbpasswdexe' -a dummyuser -n -D 10' | 
|---|
| 993 | say '2 -> 'samba.!smbpasswdexe' -x dummyuser -D 10' | 
|---|
| 994 | address cmd samba.!smbpasswdexe' -x dummyuser -D 10' | 
|---|
| 995 | say '3 -> 'samba.!pdbeditexe' --policies-reset -d=3' | 
|---|
| 996 | address cmd samba.!pdbeditexe' --policies-reset -d=3' | 
|---|
| 997 | say 'X -> ----------------------' | 
|---|
| 998 | IF options.!debug == 1 THEN say '_Smb35Init() done' | 
|---|
| 999 | return | 
|---|
| 1000 |  | 
|---|
| 1001 | /*:VRX         _SmbConfBackup | 
|---|
| 1002 | */ | 
|---|
| 1003 | _SmbConfBackup: | 
|---|
| 1004 | ok = VRCopyFile( SmbConf, SmbConf"-backup" ) | 
|---|
| 1005 | return | 
|---|
| 1006 |  | 
|---|
| 1007 | /*:VRX         _SmbConfCommitChanges | 
|---|
| 1008 | */ | 
|---|
| 1009 | _SmbConfCommitChanges: | 
|---|
| 1010 | IF options.!debug == 1 THEN say '_SmbConfCommitChanges() started' | 
|---|
| 1011 |  | 
|---|
| 1012 | src = TempDir'smb.conf' | 
|---|
| 1013 | if stream(src,'c','query size') = 0 then do | 
|---|
| 1014 | ok = VRCopyFile(smbconf,src) | 
|---|
| 1015 | end | 
|---|
| 1016 | trg = smbconf | 
|---|
| 1017 | ok = SysFileDelete(smbconf) | 
|---|
| 1018 | call lineout trg, '# Samba config file created using SSCC ver. 'word(VRGet("Main","Hinttext"),2) | 
|---|
| 1019 | call lineout trg, '# from 'value("USER",,'OS2ENVIRONMENT')'@'value("HOSTNAME",,'OS2ENVIRONMENT') | 
|---|
| 1020 | call lineout trg, '# Date: 'date()' 'time() | 
|---|
| 1021 | lct = 0 | 
|---|
| 1022 | do until lines(src) = 0 | 
|---|
| 1023 | smbline = linein(src) | 
|---|
| 1024 | if pos("idmap uid",smbline) > 0 then iterate | 
|---|
| 1025 | if pos("idmap gid",smbline) > 0 then iterate | 
|---|
| 1026 | if pos("winbind separator",smbline) > 0 then iterate | 
|---|
| 1027 | if pos("copy ",smbline) > 0 then iterate | 
|---|
| 1028 | call lineout trg, smbline | 
|---|
| 1029 | lct = lct + 1 | 
|---|
| 1030 | end | 
|---|
| 1031 | say "Lines saved "lct | 
|---|
| 1032 | ok = stream(trg,'c','close') | 
|---|
| 1033 | ok = stream(src,'c','close') | 
|---|
| 1034 | ok = SysFileDelete(src) | 
|---|
| 1035 | IF options.!debug == 1 THEN say '_SmbConfCommitChanges() done' | 
|---|
| 1036 | return | 
|---|
| 1037 |  | 
|---|
| 1038 | /*:VRX         _SmbConfCreateDefault | 
|---|
| 1039 | */ | 
|---|
| 1040 | _SmbConfCreateDefault: | 
|---|
| 1041 | ok = SysFileDelete(smbconf) | 
|---|
| 1042 |  | 
|---|
| 1043 | /* Create a basic smb.conf */ | 
|---|
| 1044 | call _SmbConfDefault_Global | 
|---|
| 1045 | call _SmbConfDefault_Scripts | 
|---|
| 1046 | if CreatePDC then do | 
|---|
| 1047 | call _SmbConfDefault_NetLogon | 
|---|
| 1048 | call _SmbConfDefault_Profiles | 
|---|
| 1049 | end | 
|---|
| 1050 | call _SmbConfDefault_Homes | 
|---|
| 1051 | call _SmbConfDefault_SharePrinters | 
|---|
| 1052 | call _SmbConfDefault_ShareDrives | 
|---|
| 1053 | ok = stream(smbconf,'c','close') | 
|---|
| 1054 | return | 
|---|
| 1055 |  | 
|---|
| 1056 | /*:VRX         _SmbConfCreateDefault_OldInstall | 
|---|
| 1057 | */ | 
|---|
| 1058 | _SmbConfCreateDefault_OldInstall: | 
|---|
| 1059 | DriveList = SysDriveMap('C:','Local') | 
|---|
| 1060 | ok = SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', 'ALL:','printers.') | 
|---|
| 1061 | ok = VRSet("EF_NetBIOS_Name","Value", Value("HOSTNAME",,"OS2ENVIRONMENT")) | 
|---|
| 1062 |  | 
|---|
| 1063 | DrivesOH.0 = 0 | 
|---|
| 1064 | do I = 1 to words(DriveList) | 
|---|
| 1065 | CurDrive = word(DriveList,I) | 
|---|
| 1066 | Filesys = SysFilesystemType(Curdrive) | 
|---|
| 1067 | DriveInfo=SysDriveInfo(CurDrive) | 
|---|
| 1068 | parse var DriveInfo DrvLet CurFree CurSize CurLabel | 
|---|
| 1069 | curlabel = strip(Curlabel) | 
|---|
| 1070 | CurFree = word(Driveinfo,2) | 
|---|
| 1071 | CurSize = word(Driveinfo,3) | 
|---|
| 1072 | if Curlabel = "" then Curlabel = '?' | 
|---|
| 1073 |  | 
|---|
| 1074 | if datatype(CurSize) = 'NUM' then do | 
|---|
| 1075 | CurSize = CurSize/(1024*1024) | 
|---|
| 1076 | CurFree = CurFree/(1024*1024) | 
|---|
| 1077 |  | 
|---|
| 1078 | CurSize = format(CurSize,,0)'MB' | 
|---|
| 1079 | CurFree = format(CurFree,,0)'MB' | 
|---|
| 1080 | end | 
|---|
| 1081 | else do | 
|---|
| 1082 | CurSize = '?' | 
|---|
| 1083 | CurFree = '?' | 
|---|
| 1084 | end | 
|---|
| 1085 |  | 
|---|
| 1086 | /*      DrivesOH.I = VRCreate( "GB_Drives", "CheckBox", "Name", "CB_"left(CurDrive,1), "Top", 120, "Left", 1325+(I-1)*420, "Visible", 1, "Caption", CurDrive, "AutoSize", 1, "set", 1, "Userdata", FileSys, "HintText", CurDrive' ('Curlabel', 'FileSys') size: 'CurSize', free: 'CurFree)  */ | 
|---|
| 1087 | Shares.!drives.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!dirs,,left(CurDrive,1) ,"#4") | 
|---|
| 1088 | if FileSys = '' | FileSys = 'CDFS' then do | 
|---|
| 1089 | /*          ok = VRSet(DrivesOH.I, "ForeColor", "Red") */ | 
|---|
| 1090 | end | 
|---|
| 1091 | /*      if CurDrive = SysBootDrive() then ok = VRSet(DrivesOH.I, "Set", 0) | 
|---|
| 1092 | if CurDrive = translate(left(samba.!bin,2)) then ok = VRSet(DrivesOH.I, "Set", 0) */ | 
|---|
| 1093 | end | 
|---|
| 1094 | DrivesOH.0 = I-1 | 
|---|
| 1095 |  | 
|---|
| 1096 | PrintersOH.0 = 0 | 
|---|
| 1097 | Colum = 1325 | 
|---|
| 1098 | dx = 0 | 
|---|
| 1099 | do I = 1 to printers.0 | 
|---|
| 1100 | queue = printers.I | 
|---|
| 1101 | name = strip(strip(SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', printers.I),'T','00'x),,';') | 
|---|
| 1102 | /*      PrintersOH.I = VRCreate( "GB_printers", "CheckBox", "Name", "CB_"queue, "Top", 120+(I-1-dx)*250, "Left", Colum, "Visible", 1, "Caption", Name, "AutoSize", 1, "set", 1, "UserData", Queue)     */ | 
|---|
| 1103 | Shares.!printers.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!printers,,queue,"#6") | 
|---|
| 1104 | if I = 6 then do | 
|---|
| 1105 | Colum = 4000 | 
|---|
| 1106 | dx = 6 | 
|---|
| 1107 | end | 
|---|
| 1108 | end | 
|---|
| 1109 | PrintersOH.0 = I-1 | 
|---|
| 1110 | return | 
|---|
| 1111 |  | 
|---|
| 1112 | /*:VRX         _SmbConfDefault_Global | 
|---|
| 1113 | */ | 
|---|
| 1114 | _SmbConfDefault_Global: | 
|---|
| 1115 | Migrate = (arg(1) = 1) | 
|---|
| 1116 | if \Migrate then do /* when migrating these 4 lines are there already */ | 
|---|
| 1117 | section       = '[global]' | 
|---|
| 1118 | call lineout smbconf, section | 
|---|
| 1119 | call lineout smbconf, Indent||'workgroup = 'VRGet("EF_Workgroup_Initial","value") | 
|---|
| 1120 | call lineout smbconf, Indent||'netbios name = 'value('HOSTNAME',,'OS2ENVIRONMENT') | 
|---|
| 1121 | call lineout smbconf, Indent||'server string = %h Samba Server for eCS (OS/2)' | 
|---|
| 1122 | call lineout smbconf, Indent||'comment = Samba Server for eCS (OS/2)' | 
|---|
| 1123 | end | 
|---|
| 1124 |  | 
|---|
| 1125 | call lineout smbconf, Indent||'dos charset = IBM-850' | 
|---|
| 1126 | call lineout smbconf, Indent||'display charset = IBM-850' | 
|---|
| 1127 | call lineout smbconf, Indent||'unix charset = IBM-850' | 
|---|
| 1128 |  | 
|---|
| 1129 | CurCP = SysQueryProcessCodePage() | 
|---|
| 1130 | if CurCP <> "850" then do | 
|---|
| 1131 | Msg.Text = NLVGetMessage(117) | 
|---|
| 1132 | Msg.Type = "W" | 
|---|
| 1133 | call _ShowMsg | 
|---|
| 1134 | end | 
|---|
| 1135 | if UseTDBsam = 1 then do | 
|---|
| 1136 | call lineout smbconf, Indent||'passdb backend = tdbsam' | 
|---|
| 1137 | end | 
|---|
| 1138 | call lineout smbconf, Indent||'log level = 2' | 
|---|
| 1139 | call lineout smbconf, Indent||'log file = '||ETC||'\samba\log\log.smbd.%U.%M' | 
|---|
| 1140 | call lineout smbconf, Indent||'null passwords = Yes' | 
|---|
| 1141 | call lineout smbconf, Indent||'guest account = guest' | 
|---|
| 1142 | call lineout smbconf, Indent||'security = user' | 
|---|
| 1143 | call lineout smbconf, Indent||'load printers = No' | 
|---|
| 1144 | call lineout smbconf, Indent||'time server = Yes' | 
|---|
| 1145 | call lineout smbconf, Indent||'lock directory = '||ETC||'\samba\lock' | 
|---|
| 1146 | /* This EA makes the testparm warning about browsing go away. | 
|---|
| 1147 | Note: The EA is NOT marked critical as it should be, | 
|---|
| 1148 | neverthelesse this fix works */ | 
|---|
| 1149 | ok = SysPutEA(ETC||'\samba\lock',"MODE", "FEFF0400ED410000"x) | 
|---|
| 1150 | call lineout smbconf, Indent||'ea support = Yes' | 
|---|
| 1151 | call lineout smbconf, Indent||'store dos attributes = Yes' | 
|---|
| 1152 | call lineout smbconf, Indent||'lm announce = Yes' | 
|---|
| 1153 | call lineout smbconf, Indent||'wins support = Yes' | 
|---|
| 1154 | call lineout smbconf, Indent||'wide links = No' | 
|---|
| 1155 | ok = SysFileTree(samba.!printcap,exist.,'FO') | 
|---|
| 1156 | if exist.0 = 1 then do | 
|---|
| 1157 | call lineout smbconf, Indent||'printcap name = 'samba.!printcap | 
|---|
| 1158 | end | 
|---|
| 1159 | samba.!smbusermap = ETC||'\samba\private\smbusermap' | 
|---|
| 1160 | call lineout smbconf, Indent||'username map = 'samba.!smbusermap | 
|---|
| 1161 | if \VRFileExists(samba.!smbusermap) then call _SmbUserMapCreate | 
|---|
| 1162 | if CreatePDC then do | 
|---|
| 1163 | call lineout smbconf, Indent||'local master = Yes' | 
|---|
| 1164 | call lineout smbconf, Indent||'preferred master = Yes' | 
|---|
| 1165 | call lineout smbconf, Indent||'domain master = Yes' | 
|---|
| 1166 | call lineout smbconf, Indent||'os level = 65' | 
|---|
| 1167 | call lineout smbconf, ';'Indent||'domain groups =' | 
|---|
| 1168 | call lineout smbconf, ';'Indent||'domain admin group = ' | 
|---|
| 1169 | call lineout smbconf, Indent||'domain admin users = root' | 
|---|
| 1170 | call lineout smbconf, Indent||'domain logons = Yes' | 
|---|
| 1171 | call lineout smbconf, Indent||'logon home = \\%L\Profiles\%U' | 
|---|
| 1172 | call lineout smbconf, Indent||'logon path = \\%L\Profiles\%U' | 
|---|
| 1173 | call lineout smbconf, Indent||'logon drive = z:' | 
|---|
| 1174 | call lineout smbconf, Indent||'logon script = %U.cmd' | 
|---|
| 1175 | end | 
|---|
| 1176 | else do | 
|---|
| 1177 | call lineout smbconf, Indent||'create mask = 0777' | 
|---|
| 1178 | end | 
|---|
| 1179 | ok = stream(smbconf, 'c','close') | 
|---|
| 1180 | return | 
|---|
| 1181 | /*:VRX         _SmbConfDefault_Homes | 
|---|
| 1182 | */ | 
|---|
| 1183 | _SmbConfDefault_Homes: | 
|---|
| 1184 | /* Create Homes section */ | 
|---|
| 1185 | call lineout smbconf, '[HOMES]' | 
|---|
| 1186 | call lineout smbconf, Indent||"comment = Home directory" | 
|---|
| 1187 | smbhome = samba.!bin'\homes' | 
|---|
| 1188 | Home = strip(value('Home',,'OS2ENVIRONMENT'),'T','\') | 
|---|
| 1189 | if Home <> '' then do | 
|---|
| 1190 | User = value('USER',,'OS2ENVIRONMENT') | 
|---|
| 1191 | if User <> '' then do | 
|---|
| 1192 | if translate(User) = translate(Filespec('N',Home)) | translate(Filespec('N',Home)) = "DEFAULT"  then smbHome = strip(filespec('D',Home)||filespec('P',Home),'T','\') | 
|---|
| 1193 | end | 
|---|
| 1194 | end | 
|---|
| 1195 | ok = SysMkDir(smbhome) | 
|---|
| 1196 | call lineout smbconf, Indent||"path = "_bs2fs(smbhome)'/%u' | 
|---|
| 1197 | call lineout smbconf, Indent||"read only = No" | 
|---|
| 1198 | call lineout smbconf, Indent||"browseable = No" | 
|---|
| 1199 | call lineout smbconf, Indent | 
|---|
| 1200 | ok = stream(smbconf, 'c','close') | 
|---|
| 1201 | return | 
|---|
| 1202 |  | 
|---|
| 1203 | /*:VRX         _SmbConfDefault_Netlogon | 
|---|
| 1204 | */ | 
|---|
| 1205 | _SmbConfDefault_Netlogon: | 
|---|
| 1206 | /* Create Netlogon section */ | 
|---|
| 1207 | call lineout smbconf, '[NETLOGON]' | 
|---|
| 1208 | call lineout smbconf, Indent||"comment = Netlogon service" | 
|---|
| 1209 | smbnetlogon = samba.!bin'\netlogon' | 
|---|
| 1210 | ok = SysMkDir(smbnetlogon) | 
|---|
| 1211 | call lineout smbconf, Indent||"path = "_bs2fs(smbnetlogon) | 
|---|
| 1212 | call lineout smbconf, Indent||"read only = Yes" | 
|---|
| 1213 | call lineout smbconf, Indent||"browseable = Yes" | 
|---|
| 1214 | call lineout smbconf, Indent||"share modes = No" | 
|---|
| 1215 | call lineout smbconf, Indent | 
|---|
| 1216 | ok = stream(smbconf, 'c','close') | 
|---|
| 1217 | return | 
|---|
| 1218 |  | 
|---|
| 1219 | /*:VRX         _SmbConfDefault_Profiles | 
|---|
| 1220 | */ | 
|---|
| 1221 | _SmbConfDefault_Profiles: | 
|---|
| 1222 | /* Create profiles section */ | 
|---|
| 1223 | call lineout smbconf, '[profiles]' | 
|---|
| 1224 | call lineout smbconf, Indent||"comment = profiles" | 
|---|
| 1225 | smbprofiles = samba.!bin'\profiles' | 
|---|
| 1226 | ok = SysMkDir(smbprofiles) | 
|---|
| 1227 | call lineout smbconf, Indent||"path = "_bs2fs(smbprofiles) | 
|---|
| 1228 | call lineout smbconf, Indent||"profile acls = Yes" | 
|---|
| 1229 | call lineout smbconf, Indent||"read only = No" | 
|---|
| 1230 | call lineout smbconf, Indent||"browseable = Yes" | 
|---|
| 1231 | call lineout smbconf, Indent||"create mask = 0777" | 
|---|
| 1232 | call lineout smbconf, Indent||"directory mask = 0777" | 
|---|
| 1233 | call lineout smbconf, Indent | 
|---|
| 1234 | ok = stream(smbconf, 'c','close') | 
|---|
| 1235 | return | 
|---|
| 1236 |  | 
|---|
| 1237 | /*:VRX         _SmbConfDefault_Scripts | 
|---|
| 1238 | */ | 
|---|
| 1239 | _SmbConfDefault_Scripts: | 
|---|
| 1240 | smbtools = samba.!bin | 
|---|
| 1241 |  | 
|---|
| 1242 | /* user scripts */ | 
|---|
| 1243 | call lineout smbconf, ';'||Indent||'user scripts' | 
|---|
| 1244 | call lineout smbconf, Indent||'add user script          = '||smbtools||'\usermod.cmd -a "%u"' | 
|---|
| 1245 | call lineout smbconf, Indent||'delete user script       = '||smbtools||'\usermod.cmd -x "%u"' | 
|---|
| 1246 | call lineout smbconf, Indent||'rename user script       = '||smbtools||'\usermod.cmd -r "%uold" "%unew"' | 
|---|
| 1247 | call lineout smbconf, Indent||'add machine script       = '||smbtools||'\usermod.cmd -a "%u"' | 
|---|
| 1248 | call lineout smbconf, Indent||'set primary group script = '||smbtools||'\usermod.cmd -p "%u" "%g"' | 
|---|
| 1249 |  | 
|---|
| 1250 | /* group scripts */ | 
|---|
| 1251 | call lineout smbconf, ';'||Indent||'group scripts' | 
|---|
| 1252 | call lineout smbconf, Indent||'add group script              = '||smbtools||'\groupmod.cmd -a "%g"' | 
|---|
| 1253 | call lineout smbconf, Indent||'delete group script           = '||smbtools||'\groupmod.cmd -x "%g"' | 
|---|
| 1254 | call lineout smbconf, Indent||'add user to group script      = '||smbtools||'\groupmod.cmd -j "%g" "%u"' | 
|---|
| 1255 | call lineout smbconf, Indent||'delete user from group script = '||smbtools||'\groupmod.cmd -l "%g" "%u"' | 
|---|
| 1256 |  | 
|---|
| 1257 | /* share scripts */ | 
|---|
| 1258 | call lineout smbconf, ';'||Indent||'share scripts' | 
|---|
| 1259 | call lineout smbconf, Indent||'add share command = '||smbtools||'\addshare.cmd' | 
|---|
| 1260 | call lineout smbconf, Indent||'change share command = '||smbtools||'\changeshare.cmd' | 
|---|
| 1261 | call lineout smbconf, Indent||'delete share command = '||smbtools||'\delshare.cmd' | 
|---|
| 1262 |  | 
|---|
| 1263 | /* other scripts */ | 
|---|
| 1264 | call lineout smbconf, ';'||Indent||'other scripts' | 
|---|
| 1265 | call lineout smbconf, Indent||'enumports command = '||smbtools||'\enumports.cmd' | 
|---|
| 1266 | call lineout smbconf, Indent | 
|---|
| 1267 | call lineout smbconf | 
|---|
| 1268 | ok = stream(smbconf, 'c','close') | 
|---|
| 1269 | return | 
|---|
| 1270 |  | 
|---|
| 1271 | /*:VRX         _SmbConfDefault_ShareDrives | 
|---|
| 1272 | */ | 
|---|
| 1273 | _SmbConfDefault_ShareDrives: | 
|---|
| 1274 | DriveList = SysDriveMap('C:','Local') | 
|---|
| 1275 |  | 
|---|
| 1276 | do I = 1 to words(DriveList) | 
|---|
| 1277 | CurDrive = word(DriveList,I) | 
|---|
| 1278 | say CurDrive | 
|---|
| 1279 | Filesys = SysFilesystemType(Curdrive) | 
|---|
| 1280 | DriveInfo=SysDriveInfo(CurDrive) | 
|---|
| 1281 | parse var DriveInfo DrvLet CurFree CurSize CurLabel | 
|---|
| 1282 |  | 
|---|
| 1283 | if FileSys = '' | FileSys = 'CDFS' then do | 
|---|
| 1284 | read_write = 'read only = Yes' | 
|---|
| 1285 | end | 
|---|
| 1286 | else do | 
|---|
| 1287 | read_write = 'read only = No' | 
|---|
| 1288 | end | 
|---|
| 1289 | if FileSys = '' then FileSys = 'CDFS' | 
|---|
| 1290 |  | 
|---|
| 1291 | section    = '['left(curdrive,1)']' | 
|---|
| 1292 | comment    = 'comment = 'Drive' 'CurDrive' ('FileSys')' | 
|---|
| 1293 | path       = 'path = 'Curdrive'/' | 
|---|
| 1294 | guest_ok = 'guest ok = Yes' | 
|---|
| 1295 | hide_files = 'hide files = /*. SF/root/' | 
|---|
| 1296 |  | 
|---|
| 1297 | call lineout smbconf, section | 
|---|
| 1298 | call lineout smbconf, Indent||comment | 
|---|
| 1299 | call lineout smbconf, Indent||path | 
|---|
| 1300 | call lineout smbconf, Indent||read_write | 
|---|
| 1301 | call lineout smbconf, Indent||guest_ok | 
|---|
| 1302 | call lineout smbconf, Indent||hide_files | 
|---|
| 1303 | call lineout smbconf, Indent | 
|---|
| 1304 | end | 
|---|
| 1305 | ok = stream(smbconf, 'c','close') | 
|---|
| 1306 | return | 
|---|
| 1307 |  | 
|---|
| 1308 | /*      browsable  = 'browsable = Yes' | 
|---|
| 1309 | printable  = 'printable = No' | 
|---|
| 1310 | public     = 'public = Yes' | 
|---|
| 1311 | call lineout smbconf, Indent||browsable | 
|---|
| 1312 | call lineout smbconf, Indent||printable | 
|---|
| 1313 | call lineout smbconf, Indent||public    */ | 
|---|
| 1314 | /*:VRX         _SmbConfDefault_SharePrinters | 
|---|
| 1315 | */ | 
|---|
| 1316 | _SmbConfDefault_SharePrinters: | 
|---|
| 1317 | ok = SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', 'ALL:','printers.') | 
|---|
| 1318 |  | 
|---|
| 1319 | do I = 1 to printers.0 | 
|---|
| 1320 | queue = printers.I | 
|---|
| 1321 | name = strip(strip(SysIni('SYSTEM', 'PM_SPOOLER_QUEUE_DESCR', printers.I),'T','00'x),,';') | 
|---|
| 1322 |  | 
|---|
| 1323 | /*      call lineout samba.!printcap, queue'|'name */ | 
|---|
| 1324 |  | 
|---|
| 1325 | section       = '['queue']' | 
|---|
| 1326 | path          = 'path = 'ETC'\samba\spool\'queue | 
|---|
| 1327 | ok = SysMkDir(ETC'\samba\spool\'queue) | 
|---|
| 1328 | comment       = 'comment = 'name | 
|---|
| 1329 | create_mask   = 'create mask = 0700' | 
|---|
| 1330 | guest_ok = 'guest ok = Yes' | 
|---|
| 1331 |  | 
|---|
| 1332 | printable     = 'printable = Yes' | 
|---|
| 1333 | print_command = 'print command = 'samba.!bin'\smbprint.exe "%s" "%p" "%J" "%c" "%z"' | 
|---|
| 1334 | printer_name  = 'printer name = 'queue | 
|---|
| 1335 |  | 
|---|
| 1336 | call lineout smbconf, section | 
|---|
| 1337 | call lineout smbconf, Indent||comment | 
|---|
| 1338 | call lineout smbconf, Indent||path | 
|---|
| 1339 | call lineout smbconf, Indent||create_mask | 
|---|
| 1340 | call lineout smbconf, Indent||printable | 
|---|
| 1341 | call lineout smbconf, Indent||print_command | 
|---|
| 1342 | call lineout smbconf, Indent||printer_name | 
|---|
| 1343 | call lineout smbconf, Indent||guest_ok | 
|---|
| 1344 |  | 
|---|
| 1345 | call lineout smbconf, Indent | 
|---|
| 1346 |  | 
|---|
| 1347 | end | 
|---|
| 1348 | ok = stream(smbconf, 'c','close') | 
|---|
| 1349 | ok = stream(samba.!printcap,'c','close') | 
|---|
| 1350 | return | 
|---|
| 1351 |  | 
|---|
| 1352 | /*  browsable     = 'browsable = Yes' | 
|---|
| 1353 | call lineout smbconf, Indent||browsable */ | 
|---|
| 1354 | /*:VRX         _SmbConfLoad | 
|---|
| 1355 | */ | 
|---|
| 1356 | _SmbConfLoad: | 
|---|
| 1357 | IF options.!debug == 1 THEN say '_SmbConfLoad() started' | 
|---|
| 1358 | IF options.!debug == 1 THEN say '  Loading "'samba.!smbconf'" ('stream(samba.!smbconf,'c','query size')' bytes)' | 
|---|
| 1359 |  | 
|---|
| 1360 | /*  ok = IniEnumSections(sections., samba.!smbconf) */ | 
|---|
| 1361 |  | 
|---|
| 1362 | section. = "" | 
|---|
| 1363 | sections.0 = 0 | 
|---|
| 1364 | call _MyIniEnumSections(samba.!smbconf) | 
|---|
| 1365 |  | 
|---|
| 1366 | special = 'global printers netlogon print$ homes profiles' | 
|---|
| 1367 | Specialstatus.0 = sections.0 | 
|---|
| 1368 | PrintStatus.0 = sections.0 | 
|---|
| 1369 | sectionhandles.0 = sections.0 | 
|---|
| 1370 | recordhandle.0 = sections.0 | 
|---|
| 1371 |  | 
|---|
| 1372 | do I = 1 to sections.0 | 
|---|
| 1373 | IF options.!debug == 1 THEN say '  ['sections.I'] section loaded' | 
|---|
| 1374 | if wordpos(translate(sections.I),translate(special)) > 0 Then SpecialStatus.I = 1 | 
|---|
| 1375 | Else SpecialStatus.I = 0 | 
|---|
| 1376 | PrintRes = IniGet("Printable", sections.I, samba.!smbconf) | 
|---|
| 1377 | if Translate(PrintRes) = "YES" | Translate(PrintRes) = "TRUE" then PrintStatus.I = 1 | 
|---|
| 1378 | else PrintStatus.I = 0 | 
|---|
| 1379 |  | 
|---|
| 1380 | IF options.!debug == 1 THEN say '  ['sections.I'] status (special:'SpecialStatus.I', print:'Printstatus.I')' | 
|---|
| 1381 | if Printstatus.I = 1 & SpecialStatus.I = 0 then do /* printer share */ | 
|---|
| 1382 | recordhandle.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!printers,,sections.I,"#65:PMWP.DLL") | 
|---|
| 1383 | ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"ReadOnly", 1) | 
|---|
| 1384 | IF options.!debug == 1 THEN say '  ['sections.I'] added to shared printer tree' | 
|---|
| 1385 | end | 
|---|
| 1386 | if Printstatus.I = 0 & SpecialStatus.I = 0 then do /* directory share */ | 
|---|
| 1387 | recordhandle.I = VRMethod( "CN_smbconf", "AddRecord", smbconf.!dirs,,    sections.I,"#64:PMWP.DLL") | 
|---|
| 1388 | ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"ReadOnly", 1) | 
|---|
| 1389 | IF options.!debug == 1 THEN say '  ['sections.I'] added to shared folder tree' | 
|---|
| 1390 | end | 
|---|
| 1391 | if translate(sections.I) = 'PROFILES' then do | 
|---|
| 1392 | recordhandle.I = smbconf.!profiles | 
|---|
| 1393 | ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"Visible", 1) | 
|---|
| 1394 | end | 
|---|
| 1395 | if translate(sections.I) = 'NETLOGON' then do | 
|---|
| 1396 | recordhandle.I = smbconf.!netlogon | 
|---|
| 1397 | ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"Visible", 1) | 
|---|
| 1398 | end | 
|---|
| 1399 | if translate(sections.I) = 'HOMES' then do | 
|---|
| 1400 | recordhandle.I = smbconf.!homes | 
|---|
| 1401 | ok = VRMethod("CN_smbconf","SetRecordAttr",recordhandle.I,"Visible", 1) | 
|---|
| 1402 | end | 
|---|
| 1403 | if translate(sections.I) = 'GLOBAL' then recordhandle.I = smbconf.!global | 
|---|
| 1404 | end | 
|---|
| 1405 | ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!root, "Collapsed", 0 ) | 
|---|
| 1406 | IF options.!debug == 1 THEN say '_SmbConfLoad() done' | 
|---|
| 1407 | return | 
|---|
| 1408 |  | 
|---|
| 1409 |  | 
|---|
| 1410 | /*    if VRGet("DT_AlreadySmbConf","Visible") then do | 
|---|
| 1411 | smbline = strip(translate(linein(smbconf),' ','09'x)) | 
|---|
| 1412 |  | 
|---|
| 1413 | do while translate(left(smbline,8)) <> "[GLOBAL]" | 
|---|
| 1414 | smbline = strip(translate(linein(smbconf),' ','09'x)) | 
|---|
| 1415 | end | 
|---|
| 1416 |  | 
|---|
| 1417 | do until left(smbline,1) = '[' | 
|---|
| 1418 | smbline = strip(translate(linein(smbconf),' ','09'x)) | 
|---|
| 1419 | parse var smbline voc '=' val | 
|---|
| 1420 | voc = strip(voc) | 
|---|
| 1421 | val = strip(val) | 
|---|
| 1422 | if translate(voc) = "WORKGROUP" then do | 
|---|
| 1423 | ok = VRset("EF_WorkGroup", "Value", val) | 
|---|
| 1424 | ok = VRSet("EF_WorkGroup", "BackColor", "(255,255,180)") | 
|---|
| 1425 | end | 
|---|
| 1426 | if translate(voc) = "NETBIOS NAME" then do | 
|---|
| 1427 | ok = VRset("EF_NetBIOS_Name", "Value", val) | 
|---|
| 1428 | ok = VRSet("EF_NetBIOS_Name", "BackColor", "(255,255,180)") | 
|---|
| 1429 | end | 
|---|
| 1430 | if translate(voc) = "SERVER STRING" then do | 
|---|
| 1431 | ok = VRset("EF_Server_String", "Value", val) | 
|---|
| 1432 | ok = VRSet("EF_server_string", "BackColor", "(255,255,180)") | 
|---|
| 1433 | end | 
|---|
| 1434 |  | 
|---|
| 1435 | end | 
|---|
| 1436 | ok = stream(smbconf, 'c','close') | 
|---|
| 1437 | end */ | 
|---|
| 1438 |  | 
|---|
| 1439 | /*:VRX         _SmbConfMigratePeer | 
|---|
| 1440 | */ | 
|---|
| 1441 | _SmbConfMigratePeer: | 
|---|
| 1442 | Ok = SysFileDelete(smbconf) | 
|---|
| 1443 | /* Migrate Peer To Samba */ | 
|---|
| 1444 |  | 
|---|
| 1445 | /* IBMLAN.INI part */ | 
|---|
| 1446 | ibmlanline = strip(translate(linein(ibmlanini),' ',Indent)) | 
|---|
| 1447 |  | 
|---|
| 1448 | do while translate(left(ibmlanline,11)) <> "[REQUESTER]" | 
|---|
| 1449 | ibmlanline = strip(translate(linein(ibmlanini),' ',Indent)) | 
|---|
| 1450 | end | 
|---|
| 1451 |  | 
|---|
| 1452 | call lineout smbconf, '[global]' | 
|---|
| 1453 | do until left(ibmlanline,1) = '[' | 
|---|
| 1454 | ibmlanline = strip(translate(linein(ibmlanini),' ',Indent)) | 
|---|
| 1455 | parse var ibmlanline voc '=' val | 
|---|
| 1456 | voc = strip(voc) | 
|---|
| 1457 | val = strip(val) | 
|---|
| 1458 | if translate(voc) = "DOMAIN" then do | 
|---|
| 1459 | call lineout smbconf, Indent||'workgroup = 'val | 
|---|
| 1460 | end | 
|---|
| 1461 | if translate(voc) = "COMPUTERNAME" then do | 
|---|
| 1462 | call lineout smbconf, Indent||'netbios name = 'val | 
|---|
| 1463 | end | 
|---|
| 1464 | end | 
|---|
| 1465 | do while translate(left(ibmlanline,6)) <> '[PEER]' | 
|---|
| 1466 | ibmlanline = strip(translate(linein(ibmlanini),' ',Indent)) | 
|---|
| 1467 | end | 
|---|
| 1468 | do until left(ibmlanline,1) = '[' | lines(ibmlanini) = 0 | 
|---|
| 1469 | ibmlanline = strip(translate(linein(ibmlanini),' ',Indent)) | 
|---|
| 1470 | parse var ibmlanline voc '=' val | 
|---|
| 1471 | voc = strip(voc) | 
|---|
| 1472 | val = strip(val) | 
|---|
| 1473 | if translate(voc) = "SRVCOMMENT" then do | 
|---|
| 1474 | call lineout smbconf, Indent||'server string = 'val | 
|---|
| 1475 | call lineout smbconf, Indent||'comment = 'val | 
|---|
| 1476 | end | 
|---|
| 1477 | end | 
|---|
| 1478 | call _SmbConfDefault_Global 1 /* 1 = migration mode */ | 
|---|
| 1479 |  | 
|---|
| 1480 | call _SmbConfDefault_Scripts | 
|---|
| 1481 | if CreatePDC then do | 
|---|
| 1482 | call _SmbConfDefault_NetLogon | 
|---|
| 1483 | call _SmbConfDefault_Profiles | 
|---|
| 1484 | end | 
|---|
| 1485 | call _SmbConfDefault_Homes | 
|---|
| 1486 |  | 
|---|
| 1487 | /* LSSHARE.INI part */ | 
|---|
| 1488 |  | 
|---|
| 1489 | ok = SysINI(lsshareini,"ALL:","Shares." ) | 
|---|
| 1490 | SharePath.0 = shares.0 | 
|---|
| 1491 | Comment.0 = shares.0 | 
|---|
| 1492 | Type.0 = shares.0 | 
|---|
| 1493 |  | 
|---|
| 1494 | ok = VRMethod( "Application", "ListPrinters", "printer." ) | 
|---|
| 1495 |  | 
|---|
| 1496 | do I = 1 to shares.0 | 
|---|
| 1497 | call lineout smbconf, '['Shares.I']' | 
|---|
| 1498 | sharepath.I = SysINI(lsshareini, shares.I, 'Path') | 
|---|
| 1499 | Type.I = c2d(left(SysINI(lsshareini, shares.I, 'Type'),1)) | 
|---|
| 1500 | if Type.I = '1' then do /* We migrate a printer */ | 
|---|
| 1501 | do J = 1 to printer.0 | 
|---|
| 1502 | parse var printer.J PrinterName';'PrinterQueue';'PrinterDriver | 
|---|
| 1503 | if PrinterQueue = Sharepath.I then leave | 
|---|
| 1504 | end | 
|---|
| 1505 | call lineout smbconf, Indent||'path = '_bs2fs(ETC'\samba\spool\'printerqueue) | 
|---|
| 1506 | ok = SysMkDir(ETC'\samba\spool\'printerqueue) | 
|---|
| 1507 | call lineout smbconf, Indent||'comment = 'Printername | 
|---|
| 1508 | call lineout smbconf, Indent||'create mask = 0700' | 
|---|
| 1509 | call lineout smbconf, Indent||'printer name = 'printerqueue | 
|---|
| 1510 | call lineout smbconf, Indent||'printing = os2' | 
|---|
| 1511 | call lineout smbconf, Indent||'printable = Yes' | 
|---|
| 1512 | call lineout smbconf, Indent||'print command = 'samba.!bin'\smbprint.exe "%s" "%p" "%J" "%c" "%z"' | 
|---|
| 1513 | call lineout smbconf, Indent||'browseable = Yes' | 
|---|
| 1514 | call lineout smbconf, Indent||'guest ok = Yes' | 
|---|
| 1515 | call lineout smbconf, Indent||'read only = No' | 
|---|
| 1516 | end | 
|---|
| 1517 | else do /* we migrate a folder */ | 
|---|
| 1518 | Comment.I = SysINI(lsshareini, shares.I, 'Remark') | 
|---|
| 1519 | call lineout smbconf, Indent||'comment = 'Comment.I | 
|---|
| 1520 | call lineout smbconf, Indent||'path = 'translate(Sharepath.I,'/','\') | 
|---|
| 1521 | call lineout smbconf, Indent||'read only = No' | 
|---|
| 1522 | call lineout smbconf, Indent||'browseable = Yes' | 
|---|
| 1523 | call lineout smbconf, Indent||'hide files = /*. SF/root/' | 
|---|
| 1524 | end | 
|---|
| 1525 | call lineout smbconf, " " | 
|---|
| 1526 | end | 
|---|
| 1527 | ok = stream(smbconf,'c','close') | 
|---|
| 1528 | return | 
|---|
| 1529 |  | 
|---|
| 1530 | /*:VRX         _SmbConfRestore | 
|---|
| 1531 | */ | 
|---|
| 1532 | _SmbConfRestore: | 
|---|
| 1533 | ok = VRCopyFile( SmbConf"-backup", SmbConf) | 
|---|
| 1534 | return | 
|---|
| 1535 |  | 
|---|
| 1536 | /*:VRX         _SmbConfShareRemove | 
|---|
| 1537 | */ | 
|---|
| 1538 | _SmbConfShareRemove: | 
|---|
| 1539 | Aborted = 0 | 
|---|
| 1540 | ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "SelectedHandle." ) | 
|---|
| 1541 | if Selectedhandle.0 = 0 then return | 
|---|
| 1542 | Msg.Title = NLVGetMessage(67) | 
|---|
| 1543 | do I = 1 to sections.0 | 
|---|
| 1544 | if recordhandle.I = SelectedHandle.1 then do | 
|---|
| 1545 | if recordhandle.I = smbconf.!homes | recordhandle.I = smbconf.!global then do | 
|---|
| 1546 | Msg.Text = NLVGetMessage(61, Sections.I) | 
|---|
| 1547 | Msg.Type = 'E' | 
|---|
| 1548 | call _ShowMsg | 
|---|
| 1549 | Aborted = 1 | 
|---|
| 1550 | return | 
|---|
| 1551 | end | 
|---|
| 1552 |  | 
|---|
| 1553 | Msg.Text = NLVGetMessage(62, Sections.I) | 
|---|
| 1554 | Msg.Type = "Q" | 
|---|
| 1555 | ok = _MsgYesNo() | 
|---|
| 1556 | if ok = 2 then return | 
|---|
| 1557 |  | 
|---|
| 1558 | NewSmbConf = TempDir'smb.conf' | 
|---|
| 1559 | ok = SysFileDelete(NewSmbConf) | 
|---|
| 1560 | smbline = strip(linein(smbconf)) | 
|---|
| 1561 | do while left(translate(smbline),length(sections.I)+2) <> translate('['sections.I']') | 
|---|
| 1562 | call lineout NewSmbConf, smbline | 
|---|
| 1563 | smbline = strip(linein(smbconf)) | 
|---|
| 1564 | end | 
|---|
| 1565 | smbline = strip(linein(smbconf)) | 
|---|
| 1566 | do while left(translate(smbline),1) <> '[' & lines(smbconf) <> 0 | 
|---|
| 1567 | smbline = strip(linein(smbconf)) | 
|---|
| 1568 | end | 
|---|
| 1569 | do until lines(smbconf) = 0 | 
|---|
| 1570 | call lineout NewSmbConf, smbline | 
|---|
| 1571 | smbline = strip(linein(smbconf)) | 
|---|
| 1572 | end | 
|---|
| 1573 | call lineout NewSmbConf, smbline | 
|---|
| 1574 | ok = stream(smbconf, 'c', 'close') | 
|---|
| 1575 | ok = stream(Newsmbconf, 'c', 'close') | 
|---|
| 1576 | ok = VRCopyFile( NewSmbConf, smbconf ) | 
|---|
| 1577 | end | 
|---|
| 1578 | end | 
|---|
| 1579 | call _SmbConfTreeReset | 
|---|
| 1580 |  | 
|---|
| 1581 | if _SambaRunning() then do | 
|---|
| 1582 | Msg.Text = NLVGetMessage(69) | 
|---|
| 1583 | Msg.Type = 'I' | 
|---|
| 1584 | call _ShowMsg | 
|---|
| 1585 | end | 
|---|
| 1586 | return | 
|---|
| 1587 |  | 
|---|
| 1588 | /*:VRX         _SmbConfShareRename | 
|---|
| 1589 | */ | 
|---|
| 1590 | _SmbConfShareRename: | 
|---|
| 1591 | Aborted = 0 | 
|---|
| 1592 | ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "SelectedHandle." ) | 
|---|
| 1593 | if Selectedhandle.0 = 0 then return | 
|---|
| 1594 |  | 
|---|
| 1595 | do I = 1 to sections.0 | 
|---|
| 1596 | if recordhandle.I = SelectedHandle.1 then do | 
|---|
| 1597 | if recordhandle.I = smbconf.!homes | recordhandle.I = smbconf.!global then do | 
|---|
| 1598 | Msg.Text = NLVGetMessage(66, Sections.I) | 
|---|
| 1599 | Msg.Type = 'E' | 
|---|
| 1600 | call _ShowMsg | 
|---|
| 1601 | Aborted = 1 | 
|---|
| 1602 | return | 
|---|
| 1603 | end | 
|---|
| 1604 | Buttons.1 = NLVGetMessage(2) | 
|---|
| 1605 | Buttons.2 = NLVGetMessage(3) | 
|---|
| 1606 | Buttons.0 = 2 | 
|---|
| 1607 | NewShareName = Sections.I | 
|---|
| 1608 | id = VRPrompt( VRWindow(), NLVGetMessage(66), "NewShareName", NLVGetMessage(68), "Buttons.", buttons.1, buttons.2 ) | 
|---|
| 1609 | if ID = 2 | NewShareName = "" then return | 
|---|
| 1610 |  | 
|---|
| 1611 | NewSmbConf = TempDir'smb.conf' | 
|---|
| 1612 | ok = SysFileDelete(NewSmbConf) | 
|---|
| 1613 | smbline = strip(linein(smbconf)) | 
|---|
| 1614 | do while left(translate(smbline),length(sections.I)+2) <> translate('['sections.I']') | 
|---|
| 1615 | call lineout NewSmbConf, smbline | 
|---|
| 1616 | smbline = strip(linein(smbconf)) | 
|---|
| 1617 | end | 
|---|
| 1618 | call lineout NewSmbConf, '['NewShareName']' | 
|---|
| 1619 | smbline = strip(linein(smbconf)) | 
|---|
| 1620 | do until lines(smbconf) = 0 | 
|---|
| 1621 | call lineout NewSmbConf, smbline | 
|---|
| 1622 | smbline = strip(linein(smbconf)) | 
|---|
| 1623 | end | 
|---|
| 1624 | call lineout NewSmbConf, smbline | 
|---|
| 1625 | ok = stream(smbconf, 'c', 'close') | 
|---|
| 1626 | ok = stream(Newsmbconf, 'c', 'close') | 
|---|
| 1627 | ok = VRCopyFile( NewSmbConf, smbconf ) | 
|---|
| 1628 | end | 
|---|
| 1629 | end | 
|---|
| 1630 | call _SmbConfTreeReset | 
|---|
| 1631 |  | 
|---|
| 1632 | if _SambaRunning() then do | 
|---|
| 1633 | Msg.Text = NLVGetMessage(69) | 
|---|
| 1634 | Msg.Type = 'I' | 
|---|
| 1635 | call _ShowMsg | 
|---|
| 1636 | end | 
|---|
| 1637 | return | 
|---|
| 1638 |  | 
|---|
| 1639 | /*:VRX         _SmbConfTreeInit | 
|---|
| 1640 | */ | 
|---|
| 1641 | _SmbConfTreeInit: | 
|---|
| 1642 | IF options.!debug == 1 THEN say '_SmbConfTreeInit() started.' | 
|---|
| 1643 | call _CfgPageSetupSize "GB_Help" | 
|---|
| 1644 | call _CfgPageSetupSize "GB_Global" | 
|---|
| 1645 | call _CfgPageSetupSize "GB_Shares" | 
|---|
| 1646 | IF options.!debug == 1 THEN say '  Page setup done.' | 
|---|
| 1647 |  | 
|---|
| 1648 | ok = VRMethod("CN_smbconf", "RemoveRecord", "ALL") | 
|---|
| 1649 | smbconf.!root     = VRMethod( "CN_smbconf", "AddRecord",,, "smb.conf","#33:PMWP.DLL") | 
|---|
| 1650 | smbconf.!global   = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Global","#33:PMWP.DLL") | 
|---|
| 1651 | smbconf.!homes    = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Homes","#33:PMWP.DLL") | 
|---|
| 1652 | smbconf.!netlogon = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Netlogon","#33:PMWP.DLL") | 
|---|
| 1653 | smbconf.!profiles = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, "Profiles","#33:PMWP.DLL") | 
|---|
| 1654 | smbconf.!printers = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, NLVGetMessage(45),"#93:PMWP.DLL") | 
|---|
| 1655 | smbconf.!dirs     = VRMethod( "CN_smbconf", "AddRecord", smbconf.!root,, NLVGetMessage(46),"#27:PMWP.DLL") | 
|---|
| 1656 | IF options.!debug == 1 THEN say '  smb.conf sections created.' | 
|---|
| 1657 |  | 
|---|
| 1658 | ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!netlogon, "Visible", 0 , "ReadOnly", 1) | 
|---|
| 1659 | ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!profiles, "Visible", 0 , "ReadOnly", 1) | 
|---|
| 1660 | ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!homes,    "Visible", 0 , "ReadOnly", 1) | 
|---|
| 1661 | ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!root,     "Collapsed",1, "ReadOnly", 1 ) | 
|---|
| 1662 | ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!global,   "ReadOnly", 1) | 
|---|
| 1663 | ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "ReadOnly", 1) | 
|---|
| 1664 | ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs,     "ReadOnly", 1) | 
|---|
| 1665 |  | 
|---|
| 1666 | IF options.!debug == 1 THEN say '  visibility set.' | 
|---|
| 1667 | IF options.!debug == 1 THEN say '_SmbConfTreeInit() done.' | 
|---|
| 1668 | return | 
|---|
| 1669 |  | 
|---|
| 1670 | /*:VRX         _SmbConfTreeReset | 
|---|
| 1671 | */ | 
|---|
| 1672 | _SmbConfTreeReset: | 
|---|
| 1673 | call _SharesReset | 
|---|
| 1674 | ok = VRMethod( "CN_SmbConf", "RemoveRecord", smbconf.!root ) | 
|---|
| 1675 | call _SmbConfTreeInit | 
|---|
| 1676 | call _GUIInit | 
|---|
| 1677 | return | 
|---|
| 1678 |  | 
|---|
| 1679 | /*:VRX         _SmbUserMapCreate | 
|---|
| 1680 | */ | 
|---|
| 1681 | _SmbUserMapCreate: | 
|---|
| 1682 | call lineout samba.!smbusermap, '# Created by SSCC version 'word(VRGet("Main","Hinttext"),2)' on 'date()' at 'time() | 
|---|
| 1683 | call lineout samba.!smbusermap, '# syntax:' | 
|---|
| 1684 | call lineout samba.!smbusermap, '# Samba username = Windows username' | 
|---|
| 1685 | call lineout samba.!smbusermap, 'root = Administrator' | 
|---|
| 1686 | ok = stream(samba.!smbusermap,'c','close') | 
|---|
| 1687 | return | 
|---|
| 1688 |  | 
|---|
| 1689 | /*:VRX         About_Close | 
|---|
| 1690 | */ | 
|---|
| 1691 | About_Close: | 
|---|
| 1692 | call About_Fini | 
|---|
| 1693 | return | 
|---|
| 1694 |  | 
|---|
| 1695 | /*:VRX         About_Create | 
|---|
| 1696 | */ | 
|---|
| 1697 | About_Create: | 
|---|
| 1698 | call About_Init | 
|---|
| 1699 | ok = VRSet("About","Caption", NLVGetMessage(31)) | 
|---|
| 1700 | ok = VRSet("PB_AboutOK","Caption", NLVGetMessage(2)) | 
|---|
| 1701 | SambaTeam.0 = 9 | 
|---|
| 1702 | SambaTeam.1 = 'Silvan Scherrer' | 
|---|
| 1703 | SambaTeam.2 = 'Herwig Bauernfeind' | 
|---|
| 1704 | SambaTeam.3 = 'Vitali Pelenyov' | 
|---|
| 1705 | SambaTeam.4 = 'Paul Smedley' | 
|---|
| 1706 | SambaTeam.5 = 'Yuri Dario' | 
|---|
| 1707 | SambaTeam.6 = 'Alex Taylor' | 
|---|
| 1708 | SambaTeam.7 = 'Nikolay Kolosov' | 
|---|
| 1709 | SambaTeam.8 = 'All the Samba people' | 
|---|
| 1710 | SambaTeam.9 = 'All the netlabs people' | 
|---|
| 1711 | ok = VRSet("About","Font", VRGet("GB_Help2","Font")) | 
|---|
| 1712 | ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." ) | 
|---|
| 1713 | ok = VRSet("DT_SambaTeam","Caption", NLVGetMessage(72)) | 
|---|
| 1714 | ok = VRSet("MLE_Version","Value", NLVGetMessage(1)||'0D0A'x||VRGet("Main", "Hinttext")||'0D0A'x||'0D0A'x||SambaVer) | 
|---|
| 1715 | return | 
|---|
| 1716 |  | 
|---|
| 1717 | /*:VRX         About_Fini | 
|---|
| 1718 | */ | 
|---|
| 1719 | About_Fini: | 
|---|
| 1720 | window = VRInfo( "Window" ) | 
|---|
| 1721 | call VRDestroy window | 
|---|
| 1722 | drop window | 
|---|
| 1723 | return | 
|---|
| 1724 | /*:VRX         About_Init | 
|---|
| 1725 | */ | 
|---|
| 1726 | About_Init: | 
|---|
| 1727 | window = VRInfo( "Object" ) | 
|---|
| 1728 | if( \VRIsChildOf( window, "Notebook" ) ) then do | 
|---|
| 1729 | call VRMethod window, "CenterWindow" | 
|---|
| 1730 | call VRSet window, "Visible", 1 | 
|---|
| 1731 | call VRMethod window, "Activate" | 
|---|
| 1732 | end | 
|---|
| 1733 | drop window | 
|---|
| 1734 | return | 
|---|
| 1735 |  | 
|---|
| 1736 | /*:VRX         CB_Browseable_Click | 
|---|
| 1737 | */ | 
|---|
| 1738 | CB_Browseable_Click: | 
|---|
| 1739 | call _ShareObject_Changed | 
|---|
| 1740 | return | 
|---|
| 1741 |  | 
|---|
| 1742 | /*:VRX         CB_EA_Support_Click | 
|---|
| 1743 | */ | 
|---|
| 1744 | CB_EA_Support_Click: | 
|---|
| 1745 | call _ShareObject_Changed | 
|---|
| 1746 | return | 
|---|
| 1747 |  | 
|---|
| 1748 | /*:VRX         CB_Guest_OK_Click | 
|---|
| 1749 | */ | 
|---|
| 1750 | CB_Guest_OK_Click: | 
|---|
| 1751 | call _ShareObject_Changed | 
|---|
| 1752 | return | 
|---|
| 1753 |  | 
|---|
| 1754 | /*:VRX         CB_LM_Announce_Click | 
|---|
| 1755 | */ | 
|---|
| 1756 | CB_LM_Announce_Click: | 
|---|
| 1757 | call _ShareObject_Changed | 
|---|
| 1758 | return | 
|---|
| 1759 |  | 
|---|
| 1760 | /*:VRX         CB_Null_passwords_Click | 
|---|
| 1761 | */ | 
|---|
| 1762 | CB_Null_passwords_Click: | 
|---|
| 1763 | call _ShareObject_Changed | 
|---|
| 1764 | return | 
|---|
| 1765 |  | 
|---|
| 1766 | /*:VRX         CB_Read_Only_Click | 
|---|
| 1767 | */ | 
|---|
| 1768 | CB_Read_Only_Click: | 
|---|
| 1769 | call _ShareObject_Changed | 
|---|
| 1770 | return | 
|---|
| 1771 |  | 
|---|
| 1772 | /*:VRX         CB_RemoveSmbConf_Click | 
|---|
| 1773 | */ | 
|---|
| 1774 | CB_RemoveSmbConf_Click: | 
|---|
| 1775 | ok = VRSet("CB_RemoveBackend", "Enabled", VRGet("CB_RemoveSmbConf","set")) | 
|---|
| 1776 | if VRGet("CB_RemoveBackend", "Enabled") = 0 then ok = VRSet("CB_RemoveBackend", "Set", 0) | 
|---|
| 1777 | return | 
|---|
| 1778 |  | 
|---|
| 1779 | /*:VRX         CB_Store_DOS_attributes_Click | 
|---|
| 1780 | */ | 
|---|
| 1781 | CB_Store_DOS_attributes_Click: | 
|---|
| 1782 | call _ShareObject_Changed | 
|---|
| 1783 | return | 
|---|
| 1784 |  | 
|---|
| 1785 | /*:VRX         CB_Time_Server_Click | 
|---|
| 1786 | */ | 
|---|
| 1787 | CB_Time_Server_Click: | 
|---|
| 1788 | call _ShareObject_Changed | 
|---|
| 1789 | return | 
|---|
| 1790 |  | 
|---|
| 1791 | /*:VRX         CB_WINS_Support_Click | 
|---|
| 1792 | */ | 
|---|
| 1793 | CB_WINS_Support_Click: | 
|---|
| 1794 | call _ShareObject_Changed | 
|---|
| 1795 | return | 
|---|
| 1796 |  | 
|---|
| 1797 | /*:VRX         CN_smbconf_Click | 
|---|
| 1798 | */ | 
|---|
| 1799 | CN_smbconf_Click: | 
|---|
| 1800 | IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() started' | 
|---|
| 1801 | IF options.!debug == 1 THEN SAY '  Using 'smbconf' ('stream(smbconf,'c','query size')' bytes)' | 
|---|
| 1802 | if ValueChanged then do | 
|---|
| 1803 | if CurSection <> "" then do | 
|---|
| 1804 | Msg.Title = NLVGetMessage('1') | 
|---|
| 1805 | Msg.Text  = NLVGetMessage(60, CurSection) | 
|---|
| 1806 | ok = _MsgYesNo() | 
|---|
| 1807 | if ok = 1 then call _SaveChanges | 
|---|
| 1808 | CurSection = "" | 
|---|
| 1809 | end | 
|---|
| 1810 | end | 
|---|
| 1811 |  | 
|---|
| 1812 | Ok = VRset("Main", "Painting", 0) | 
|---|
| 1813 | ok = VRset("GB_Help",      "Visible", 0) | 
|---|
| 1814 | ok = VRset("GB_Global",    "Visible", 0) | 
|---|
| 1815 | ok = VRset("GB_Shares",    "Visible", 0) | 
|---|
| 1816 |  | 
|---|
| 1817 | ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "Prophandle." ) | 
|---|
| 1818 | if PropHandle.0 = 0 then do | 
|---|
| 1819 | IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() aborted, no handle' | 
|---|
| 1820 | Ok = VRset("Main", "Painting", 1) | 
|---|
| 1821 | return | 
|---|
| 1822 | end | 
|---|
| 1823 | ParentHandle = VRMethod("CN_smbconf","GetRecordAttr", Prophandle.1,"Parent") | 
|---|
| 1824 |  | 
|---|
| 1825 | if Prophandle.1 = smbconf.!root          then ok = VRset("GB_Help",      "Visible", 1) | 
|---|
| 1826 | if Prophandle.1 = smbconf.!global   | Parenthandle = smbconf.!global   then call _ActiveGroup "Global" | 
|---|
| 1827 | if Prophandle.1 = smbconf.!homes    | Parenthandle = smbconf.!homes    then call _ActiveGroup "Shares" | 
|---|
| 1828 | if Prophandle.1 = smbconf.!netlogon | Parenthandle = smbconf.!netlogon then call _ActiveGroup "Shares" | 
|---|
| 1829 | if Prophandle.1 = smbconf.!profiles | Parenthandle = smbconf.!profiles then call _ActiveGroup "Shares" | 
|---|
| 1830 | if Prophandle.1 = smbconf.!dirs     then call _ActiveGroup "Help" | 
|---|
| 1831 | if Prophandle.1 = smbconf.!printers then call _ActiveGroup "Help" | 
|---|
| 1832 | if Parenthandle = smbconf.!dirs     then call _ActiveGroup "Shares" | 
|---|
| 1833 | if Parenthandle = smbconf.!printers then call _ActiveGroup "Shares" | 
|---|
| 1834 |  | 
|---|
| 1835 | call _SharesReset | 
|---|
| 1836 | Ok = VRset("Main", "Painting", 1) | 
|---|
| 1837 |  | 
|---|
| 1838 | ok = VRSet("TM_Value", "Enabled", 1) | 
|---|
| 1839 | if Prophandle.1 = smbconf.!root | Prophandle.1 = smbconf.!dirs | Prophandle.1 = smbconf.!printers then do | 
|---|
| 1840 | IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() aborted, got parent handle' | 
|---|
| 1841 | Ok = VRset("Main", "Painting", 1) | 
|---|
| 1842 | return | 
|---|
| 1843 | end | 
|---|
| 1844 | IF options.!debug == 1 THEN SAY '  Got child handle, start populating now' | 
|---|
| 1845 | ObjYPos = 1280+361+72-120 | 
|---|
| 1846 | ObjXPos = 1325+72 | 
|---|
| 1847 | ObjDelta= 380 | 
|---|
| 1848 | CreatedObjs.0 = 0 | 
|---|
| 1849 | Objs = 0 | 
|---|
| 1850 |  | 
|---|
| 1851 | Page = 1 /* for global */ | 
|---|
| 1852 |  | 
|---|
| 1853 | do I = 1 to sections.0 | 
|---|
| 1854 | if Prophandle.1 <> recordhandle.I then iterate | 
|---|
| 1855 |  | 
|---|
| 1856 | Ok = VRset("Main", "Painting", 0) | 
|---|
| 1857 | CurSection = sections.I | 
|---|
| 1858 | CurSIdx = I | 
|---|
| 1859 | upCurSection = translate(CurSection) | 
|---|
| 1860 | IF options.!debug == 1 THEN SAY '  Section ['sections.I']' | 
|---|
| 1861 |  | 
|---|
| 1862 | if upCurSection = 'GLOBAL' then do | 
|---|
| 1863 | ObjYPos = 1605+-120+361+361+361+361+361+361 | 
|---|
| 1864 | ObjXPos = 1325 | 
|---|
| 1865 | ObjDelta = 320 | 
|---|
| 1866 | if Page = 1 then do | 
|---|
| 1867 | if \VRIsValidObject("GB_"ActiveGroup"_1") then do | 
|---|
| 1868 | ActiveGroupObj = VRCreate("GB_Global", "Window", "Name", "GL_GLOBAL_"Page, "Height", 1500, "Width", 1500, "Visible", 0, "Font", "9.WarpSans") | 
|---|
| 1869 | IF options.!debug == 1 THEN say '  Neues Fenster VRCreate = 'ok | 
|---|
| 1870 | ok = VRLoad( "GB_Global", VRWindowPath(), "GL_GLOBAL_"Page ) | 
|---|
| 1871 | IF options.!debug == 1 THEN say '  VRLoad = 'ok | 
|---|
| 1872 | ok = VRMethod("GB_Global", "InsertPage", "GL_GLOBAL_"Page, "+"Page) | 
|---|
| 1873 | IF options.!debug == 1 THEN  say '  InsertPage = 'ok | 
|---|
| 1874 |  | 
|---|
| 1875 | /*                    ok = VRset("Main", "Painting", 1) | 
|---|
| 1876 | Msg.Text = NLVGetMessage(114) | 
|---|
| 1877 | Msg.Type = "I" | 
|---|
| 1878 | call _ShowMsg | 
|---|
| 1879 | return */ | 
|---|
| 1880 | end | 
|---|
| 1881 | ActiveGroupObj = VRGet("GB_"ActiveGroup"_1", "Self") | 
|---|
| 1882 | end | 
|---|
| 1883 | end | 
|---|
| 1884 | else do | 
|---|
| 1885 | if \VRIsValidObject("GB_"ActiveGroup) then do | 
|---|
| 1886 | ok = VRset("Main", "Painting", 1) | 
|---|
| 1887 | Msg.Text = NLVGetMessage(114) | 
|---|
| 1888 | Msg.Type = "I" | 
|---|
| 1889 | call _ShowMsg | 
|---|
| 1890 | return | 
|---|
| 1891 | end | 
|---|
| 1892 | ActiveGroupObj = "GB_"ActiveGroup | 
|---|
| 1893 | ok = VRSet("DT_"ActiveGroup,"Caption",sections.I) | 
|---|
| 1894 | end | 
|---|
| 1895 | say "CurSection="CurSection | 
|---|
| 1896 | say "smbconf="smbconf | 
|---|
| 1897 |  | 
|---|
| 1898 | /* ok = IniEnum("Voc", hdl) */ /* Old command: Fill the Voc stem with vocabulary */ | 
|---|
| 1899 |  | 
|---|
| 1900 | call _MyIniEnum(CurSection) | 
|---|
| 1901 |  | 
|---|
| 1902 | if upCurSection <> 'GLOBAL' then do | 
|---|
| 1903 | ok = VRSet("CB_Read_Only", "set", 1) | 
|---|
| 1904 | end | 
|---|
| 1905 | do V = 1 to Voc.0  /* loop for every vocabulary */ | 
|---|
| 1906 | ValueChanged = 0 | 
|---|
| 1907 | ChangeList = "" | 
|---|
| 1908 |  | 
|---|
| 1909 | /* get value for this vocabulary */ | 
|---|
| 1910 | Val.V = IniGet(Voc.V, CurSection, samba.!smbconf) /* this is currently done by _MyIniEnum (which is probably not good) */ | 
|---|
| 1911 | select | 
|---|
| 1912 | when pos("\\",Val.V) > 0 then nop | 
|---|
| 1913 | when pos(" dir",Voc.V) > 0 then Val.V = _fs2bs(Val.V) | 
|---|
| 1914 | when pos("file",Voc.V) > 0 then Val.V = _fs2bs(Val.V) | 
|---|
| 1915 | when pos("path",Voc.V) > 0 then Val.V = _fs2bs(Val.V) | 
|---|
| 1916 | when pos("username map",Voc.V) > 0 then Val.V = _fs2bs(Val.V) | 
|---|
| 1917 | otherwise nop /* do not beautify */ | 
|---|
| 1918 | end | 
|---|
| 1919 |  | 
|---|
| 1920 | IF options.!debug == 1 THEN say '  Process: "'Voc.V'" = "'Val.V'"' | 
|---|
| 1921 |  | 
|---|
| 1922 | /* Proper format to ease checking and object creation */ | 
|---|
| 1923 | upVal = translate(Val.V) | 
|---|
| 1924 | upVoc = translate(translate(Voc.V,'_',' ')) | 
|---|
| 1925 |  | 
|---|
| 1926 | if upVal = 'YES'| upVal = 'NO' | 
|---|
| 1927 | then VocObjType = 'CB' | 
|---|
| 1928 | else VocObjType = 'EF' | 
|---|
| 1929 |  | 
|---|
| 1930 | /* Non configurable items */ | 
|---|
| 1931 | if upVoc = "PRINTABLE" then iterate | 
|---|
| 1932 | if pos('SCRIPT', upVoc)  > 0 then iterate | 
|---|
| 1933 | if pos('COMMAND', upVoc)  > 0 then iterate | 
|---|
| 1934 |  | 
|---|
| 1935 | if upVoc = "COMMENT" then do | 
|---|
| 1936 | CurPage = Page | 
|---|
| 1937 | CurActiveGroupObj = ActiveGroupObj | 
|---|
| 1938 | if Page <> 1 then ActiveGroupObj = VRGet("GB_"ActiveGroup"_1", "Self") | 
|---|
| 1939 | OldObjYPos = ObjYPos | 
|---|
| 1940 | if upCurSection = "GLOBAL" then ObjYPos = 860-120 | 
|---|
| 1941 | else ObjYPos = 860+361+72 | 
|---|
| 1942 | if _CreateVocObject() then do | 
|---|
| 1943 | ok = VRSet(VocObjType"_"upVoc, 'Value', Val.V) | 
|---|
| 1944 | ok = VRFlush( , VocObjType"_"upVoc ) | 
|---|
| 1945 | end | 
|---|
| 1946 | ActiveGroupObj = CurActiveGroupObj | 
|---|
| 1947 | Page = CurPage | 
|---|
| 1948 | ObjYPos = OldObjYPos | 
|---|
| 1949 | end | 
|---|
| 1950 | else do /* Normalfall */ | 
|---|
| 1951 | if _CreateVocObject() then do | 
|---|
| 1952 | if upVal = "YES" | upVal = "NO" then do | 
|---|
| 1953 | ok = VRset(VocObjType"_"upVoc,"Set", (upVal="YES")) | 
|---|
| 1954 | ok = VRFlush( , VocObjType"_"upVoc ) | 
|---|
| 1955 | end | 
|---|
| 1956 | else do | 
|---|
| 1957 | ok = VRSet(VocObjType"_"upVoc, 'Value', Val.V) | 
|---|
| 1958 | ok = VRFlush( , VocObjType"_"upVoc ) | 
|---|
| 1959 | if translate(VocObjType"_"upVoc) = VocObjType"_PRINTER_NAME" then do | 
|---|
| 1960 | ok = VRSet(VocObjType"_"upVoc, 'ReadOnly', 1) | 
|---|
| 1961 | ok = VRSet(VocObjType"_"upVoc, 'BackColor', 'PaleGray') | 
|---|
| 1962 | end | 
|---|
| 1963 | end | 
|---|
| 1964 | end | 
|---|
| 1965 | nop | 
|---|
| 1966 | end | 
|---|
| 1967 | ok = VRSet(VocObjType"_"upVoc, 'Userdata', V) | 
|---|
| 1968 |  | 
|---|
| 1969 | if upCurSection = 'GLOBAL' then do | 
|---|
| 1970 | if upVoc = "WINBIND_SEPARATOR" then do /* Workaround for Samba Ticket #57 */ | 
|---|
| 1971 | ok = VRset("DT_WINBIND_SEPARATOR","Visible","0") | 
|---|
| 1972 | ok = VRset("EF_WINBIND_SEPARATOR","Value","|") | 
|---|
| 1973 | ok = VRFlush( , "EF_WINBIND_SEPARATOR" ) | 
|---|
| 1974 | ok = VRset("EF_WINBIND_SEPARATOR","Visible",0) | 
|---|
| 1975 | ObjYPos = ObjYPos - ObjDelta | 
|---|
| 1976 | end | 
|---|
| 1977 |  | 
|---|
| 1978 | if ObjYPos > VRGet("GB_Global","Height") - 1200 then do | 
|---|
| 1979 | /* Ok = VRset("Main", "Painting", 1) */ | 
|---|
| 1980 | Page = Page + 1 | 
|---|
| 1981 | if Page = 2 then do | 
|---|
| 1982 | Ok = VRset("Main", "Painting", 1) | 
|---|
| 1983 | ok = VRSet("Main", 'Pointer', 'Wait' ) | 
|---|
| 1984 | Ok = VRset("Main", "Painting", 0) | 
|---|
| 1985 | end | 
|---|
| 1986 | if \VRIsValidOBject("GL_GLOBAL_"Page) then do | 
|---|
| 1987 | ActiveGroupObj = VRCreate("GB_Global", "Window", "Name", "GL_GLOBAL_"Page, "Height", 1500, "Width", 1500, "Visible", 0, "Font", "9.WarpSans") | 
|---|
| 1988 | IF options.!debug == 1 THEN say '  Neues Fenster VRCreate = 'ok | 
|---|
| 1989 | ok = VRLoad( "GB_Global", VRWindowPath(), "GL_GLOBAL_"Page ) | 
|---|
| 1990 | IF options.!debug == 1 THEN say '  VRLoad = 'ok | 
|---|
| 1991 | ok = VRMethod("GB_Global", "InsertPage", "GL_GLOBAL_"Page, "+"Page) | 
|---|
| 1992 | IF options.!debug == 1 THEN  say '  InsertPage = 'ok | 
|---|
| 1993 | end | 
|---|
| 1994 | else do | 
|---|
| 1995 | ActiveGroupObj = VRGet("GL_GLOBAL_"Page, "Self") | 
|---|
| 1996 | end | 
|---|
| 1997 | ObjYPos = 0 | 
|---|
| 1998 | IF options.!debug == 1 THEN say "  Page ="page | 
|---|
| 1999 | /* Ok = VRset("Main", "Painting", 0) */ | 
|---|
| 2000 | end | 
|---|
| 2001 | end | 
|---|
| 2002 | end | 
|---|
| 2003 | end | 
|---|
| 2004 | if upCurSection = "GLOBAL" then do | 
|---|
| 2005 | if VRGet("EF_Netbios_name","Value") = "" then do | 
|---|
| 2006 | ok = VRset("EF_NETBIOS_NAME","Value",Value("HOSTNAME",,"OS2ENVIRONMENT")) | 
|---|
| 2007 | ok = VRFlush( , "EF_NETBIOS_NAME" ) | 
|---|
| 2008 | end | 
|---|
| 2009 | if VRGet("EF_WorkGroup","Value") = "" then do | 
|---|
| 2010 | ok = VRset("EF_WorkGroup","Value","WORKGROUP") | 
|---|
| 2011 | ok = VRFlush( , "EF_WorkGroup" ) | 
|---|
| 2012 | end | 
|---|
| 2013 | end | 
|---|
| 2014 |  | 
|---|
| 2015 | Ok = VRset("Main", "Painting", 1) | 
|---|
| 2016 | ok = VRSet("Main", 'Pointer', '<default>' ) | 
|---|
| 2017 | IF options.!debug == 1 THEN SAY 'CN_smbconf_Click() done' | 
|---|
| 2018 | return | 
|---|
| 2019 | /*:VRX         CN_smbconf_ContextMenu | 
|---|
| 2020 | */ | 
|---|
| 2021 | CN_smbconf_ContextMenu: | 
|---|
| 2022 | ok = VRMethod( "CN_smbconf", "GetRecordList", "Selected", "Prophandle." ) | 
|---|
| 2023 | if PropHandle.0 = 0 then return | 
|---|
| 2024 | ParentHandle = VRMethod("CN_smbconf","GetRecordAttr", Prophandle.1,"Parent") | 
|---|
| 2025 | ok = VRset("Menu_ShareContext_AddPrinter",    "Visible", 0) | 
|---|
| 2026 | ok = VRset("Menu_ShareContext_RenamePrinter", "Visible", 0) | 
|---|
| 2027 | ok = VRset("Menu_ShareContext_RemovePrinter", "Visible", 0) | 
|---|
| 2028 | ok = VRset("Menu_ShareContext_Add",           "Visible", 0) | 
|---|
| 2029 | ok = VRset("Menu_ShareContext_Rename",        "Visible", 0) | 
|---|
| 2030 | ok = VRset("Menu_ShareContext_Remove",        "Visible", 0) | 
|---|
| 2031 |  | 
|---|
| 2032 | if Prophandle.1 = smbconf.!root          then ok = VRset("GB_Help",      "Visible", 1) | 
|---|
| 2033 | if Prophandle.1 = smbconf.!global   | Parenthandle = smbconf.!global   then return | 
|---|
| 2034 | if Prophandle.1 = smbconf.!homes    | Parenthandle = smbconf.!homes    then return | 
|---|
| 2035 | if Prophandle.1 = smbconf.!dirs then do | 
|---|
| 2036 | ok = VRset("Menu_ShareContext_Add", "Visible", 1) | 
|---|
| 2037 | end | 
|---|
| 2038 | if Parenthandle = smbconf.!dirs then do | 
|---|
| 2039 | ok = VRset("Menu_ShareContext_Add", "Visible", 1) | 
|---|
| 2040 | ok = VRset("Menu_ShareContext_Rename", "Visible", 1) | 
|---|
| 2041 | ok = VRset("Menu_ShareContext_Remove", "Visible", 1) | 
|---|
| 2042 | end | 
|---|
| 2043 | if Prophandle.1 = smbconf.!printers then do | 
|---|
| 2044 | ok = VRset("Menu_ShareContext_AddPrinter", "Visible", 1) | 
|---|
| 2045 | end | 
|---|
| 2046 | if Parenthandle = smbconf.!printers then do | 
|---|
| 2047 | ok = VRset("Menu_ShareContext_AddPrinter", "Visible", 1) | 
|---|
| 2048 | ok = VRset("Menu_ShareContext_RenamePrinter", "Visible", 1) | 
|---|
| 2049 | ok = VRset("Menu_ShareContext_RemovePrinter", "Visible", 1) | 
|---|
| 2050 | end | 
|---|
| 2051 |  | 
|---|
| 2052 | ok = VRMethod( "Menu_ShareContext", "Popup", , , "", "" ) | 
|---|
| 2053 |  | 
|---|
| 2054 | return | 
|---|
| 2055 |  | 
|---|
| 2056 | /*:VRX         EF_display_charset_Change | 
|---|
| 2057 | */ | 
|---|
| 2058 | EF_display_charset_Change: | 
|---|
| 2059 | call _ShareObject_Changed | 
|---|
| 2060 | return | 
|---|
| 2061 |  | 
|---|
| 2062 | /*:VRX         EF_dos_charset_Change | 
|---|
| 2063 | */ | 
|---|
| 2064 | EF_dos_charset_Change: | 
|---|
| 2065 | call _ShareObject_Changed | 
|---|
| 2066 | return | 
|---|
| 2067 |  | 
|---|
| 2068 | /*:VRX         EF_Log_file_Change | 
|---|
| 2069 | */ | 
|---|
| 2070 | EF_Log_file_Change: | 
|---|
| 2071 | call _ShareObject_Changed | 
|---|
| 2072 | return | 
|---|
| 2073 |  | 
|---|
| 2074 | /*:VRX         EF_LOG_LEVEL_Change | 
|---|
| 2075 | */ | 
|---|
| 2076 | EF_LOG_LEVEL_Change: | 
|---|
| 2077 | call _ShareObject_Changed | 
|---|
| 2078 | return | 
|---|
| 2079 |  | 
|---|
| 2080 | /*:VRX         EF_NetBIOS_Name_Change | 
|---|
| 2081 | */ | 
|---|
| 2082 | EF_NetBIOS_Name_Change: | 
|---|
| 2083 | call _ShareObject_Changed | 
|---|
| 2084 | return | 
|---|
| 2085 |  | 
|---|
| 2086 | /*:VRX         EF_path_Change | 
|---|
| 2087 | */ | 
|---|
| 2088 | EF_path_Change: | 
|---|
| 2089 | call _ShareObject_Changed | 
|---|
| 2090 | return | 
|---|
| 2091 |  | 
|---|
| 2092 | /*:VRX         EF_SECURITY_Change | 
|---|
| 2093 | */ | 
|---|
| 2094 | EF_SECURITY_Change: | 
|---|
| 2095 | call _ShareObject_Changed | 
|---|
| 2096 | return | 
|---|
| 2097 |  | 
|---|
| 2098 | /*:VRX         EF_Server_String_Change | 
|---|
| 2099 | */ | 
|---|
| 2100 | EF_Server_String_Change: | 
|---|
| 2101 | call _ShareObject_Changed | 
|---|
| 2102 | return | 
|---|
| 2103 |  | 
|---|
| 2104 | /*:VRX         EF_Unix_charset_Change | 
|---|
| 2105 | */ | 
|---|
| 2106 | EF_Unix_charset_Change: | 
|---|
| 2107 | call _ShareObject_Changed | 
|---|
| 2108 | return | 
|---|
| 2109 |  | 
|---|
| 2110 | /*:VRX         EF_Workgroup_Change | 
|---|
| 2111 | */ | 
|---|
| 2112 | EF_Workgroup_Change: | 
|---|
| 2113 | call _ShareObject_Changed | 
|---|
| 2114 | return | 
|---|
| 2115 |  | 
|---|
| 2116 | /*:VRX         Fini | 
|---|
| 2117 | */ | 
|---|
| 2118 | Fini: | 
|---|
| 2119 | window = VRWindow() | 
|---|
| 2120 | call VRSet window, "Visible", 0 | 
|---|
| 2121 | drop window | 
|---|
| 2122 | return 0 | 
|---|
| 2123 |  | 
|---|
| 2124 | /*:VRX         GB_Global_1_Close | 
|---|
| 2125 | */ | 
|---|
| 2126 | GB_Global_1_Close: | 
|---|
| 2127 | call GB_Global_1_Fini | 
|---|
| 2128 | return | 
|---|
| 2129 |  | 
|---|
| 2130 | /*:VRX         GB_Global_1_Create | 
|---|
| 2131 | */ | 
|---|
| 2132 | GB_Global_1_Create: | 
|---|
| 2133 | call GB_Global_1_Init | 
|---|
| 2134 | return | 
|---|
| 2135 |  | 
|---|
| 2136 | /*:VRX         GB_Global_1_Fini | 
|---|
| 2137 | */ | 
|---|
| 2138 | GB_Global_1_Fini: | 
|---|
| 2139 | window = VRInfo( "Window" ) | 
|---|
| 2140 | call VRDestroy window | 
|---|
| 2141 | drop window | 
|---|
| 2142 | return | 
|---|
| 2143 | /*:VRX         GB_Global_1_Init | 
|---|
| 2144 | */ | 
|---|
| 2145 | GB_Global_1_Init: | 
|---|
| 2146 | window = VRInfo( "Object" ) | 
|---|
| 2147 | if( \VRIsChildOf( window, "Notebook" ) ) then do | 
|---|
| 2148 | call VRMethod window, "CenterWindow" | 
|---|
| 2149 | call VRSet window, "Visible", 1 | 
|---|
| 2150 | call VRMethod window, "Activate" | 
|---|
| 2151 | end | 
|---|
| 2152 | drop window | 
|---|
| 2153 | return | 
|---|
| 2154 |  | 
|---|
| 2155 | /*:VRX         Halt | 
|---|
| 2156 | */ | 
|---|
| 2157 | Halt: | 
|---|
| 2158 | signal _VREHalt | 
|---|
| 2159 | return | 
|---|
| 2160 |  | 
|---|
| 2161 | /*:VRX         Init | 
|---|
| 2162 | */ | 
|---|
| 2163 | Init: | 
|---|
| 2164 | window = VRWindow() | 
|---|
| 2165 | call VRMethod window, "CenterWindow" | 
|---|
| 2166 | call VRSet window, "Visible", 1 | 
|---|
| 2167 | call VRMethod window, "Activate" | 
|---|
| 2168 | drop window | 
|---|
| 2169 | return | 
|---|
| 2170 |  | 
|---|
| 2171 | /*:VRX         Installer_Close | 
|---|
| 2172 | */ | 
|---|
| 2173 | Installer_Close: | 
|---|
| 2174 | Msg.Text = NLVGetMessage(114) | 
|---|
| 2175 | Msg.Type = "I" | 
|---|
| 2176 | call _ShowMsg | 
|---|
| 2177 | call Installer_Fini | 
|---|
| 2178 | return | 
|---|
| 2179 |  | 
|---|
| 2180 | /*:VRX         Installer_Create | 
|---|
| 2181 | */ | 
|---|
| 2182 | Installer_Create: | 
|---|
| 2183 | call Installer_Init | 
|---|
| 2184 | CALL NLVSetText 'Installer',                  'Caption', 90 | 
|---|
| 2185 | CALL NLVSetText 'DT_RootPasswordDescription', 'Caption', 91 | 
|---|
| 2186 | CALL NLVSetText 'DT_RootPassword',            'Caption', 92 | 
|---|
| 2187 | CALL NLVSetText 'DT_RootPassword_repeat',     'Caption', 93 | 
|---|
| 2188 | CALL NLVSetText 'CB_NoRoot',                  'Caption', 94 | 
|---|
| 2189 | CALL NLVSetText 'DT_Backend',                 'Caption', 95 | 
|---|
| 2190 | CALL NLVSetText 'DT_ServerType',              'Caption', 96 | 
|---|
| 2191 | CALL NLVSetText 'PB_Install_Default',         'Caption', 97 | 
|---|
| 2192 | CALL NLVSetText 'PB_Install_Migration',       'Caption', 98 | 
|---|
| 2193 |  | 
|---|
| 2194 | ok = VRSet("PB_Install_Migration", "Enabled", lsshareiniexists * ibmlaniniexists ) | 
|---|
| 2195 | ok = VRSet("TM_Installer","Enabled", 0) | 
|---|
| 2196 | if stream(samba.!group,'c','query exists') = "" | stream(samba.!group,'c','query size') < 120 then do | 
|---|
| 2197 | call _GroupCreate | 
|---|
| 2198 | end | 
|---|
| 2199 | if stream(samba.!masterpasswd,'c','query exists') = "" | stream(samba.!group,'c','query size') < 230 then do | 
|---|
| 2200 | call _MasterPasswdCreate | 
|---|
| 2201 | call _PasswordDBRewrite | 
|---|
| 2202 | ok = VRSet("CB_NoRoot","Enabled", 0) | 
|---|
| 2203 | end | 
|---|
| 2204 | if stream(samba.!pwddb,'c','query exists') = "" | stream(samba.!spwddb,'c','query exists') = "" then do | 
|---|
| 2205 | call _PasswordDBRewrite | 
|---|
| 2206 | ok = VRSet("CB_NoRoot","Enabled", 0) | 
|---|
| 2207 | end | 
|---|
| 2208 | if \VRFileExists(ETC'\samba\private\secrets.tdb') then do | 
|---|
| 2209 | ok = VRSet("CB_NoRoot","Enabled", 0) | 
|---|
| 2210 | end | 
|---|
| 2211 | UseTDBsam = 1 | 
|---|
| 2212 | CreatePDC = 0 | 
|---|
| 2213 | return | 
|---|
| 2214 |  | 
|---|
| 2215 | /*:VRX         Installer_Fini | 
|---|
| 2216 | */ | 
|---|
| 2217 | Installer_Fini: | 
|---|
| 2218 | window = VRInfo( "Window" ) | 
|---|
| 2219 | call VRDestroy window | 
|---|
| 2220 | drop window | 
|---|
| 2221 | return | 
|---|
| 2222 | /*:VRX         Installer_Init | 
|---|
| 2223 | */ | 
|---|
| 2224 | Installer_Init: | 
|---|
| 2225 | window = VRInfo( "Object" ) | 
|---|
| 2226 | if( \VRIsChildOf( window, "Notebook" ) ) then do | 
|---|
| 2227 | call VRMethod window, "CenterWindow" | 
|---|
| 2228 | call VRSet window, "Visible", 1 | 
|---|
| 2229 | call VRMethod window, "Activate" | 
|---|
| 2230 | end | 
|---|
| 2231 | drop window | 
|---|
| 2232 | return | 
|---|
| 2233 |  | 
|---|
| 2234 | /*:VRX         IPB_ChooseDir_Click | 
|---|
| 2235 | */ | 
|---|
| 2236 | IPB_ChooseDir_Click: | 
|---|
| 2237 | InitDir = VRGet("EF_Path","Value") | 
|---|
| 2238 | VarPos = pos('%', InitDir) | 
|---|
| 2239 | if VarPos > 0 then do | 
|---|
| 2240 | VarChar = substr(InitDir,VarPos,2) | 
|---|
| 2241 | InitDir = left(InitDir,VarPos-1) | 
|---|
| 2242 | say VarChar | 
|---|
| 2243 | end | 
|---|
| 2244 | NewPath = _dirDialog('Choose path for 'VRGet("DT_Shares","Caption"),_fs2bs(InitDir)) | 
|---|
| 2245 | if NewPath = "" then return | 
|---|
| 2246 | if VarPos > 0 then NewPath = NewPath'\'VarChar | 
|---|
| 2247 | ok = VRset("EF_Path","value",NewPath) | 
|---|
| 2248 | return | 
|---|
| 2249 |  | 
|---|
| 2250 | /*:VRX         IPB_NewItem_Click | 
|---|
| 2251 | */ | 
|---|
| 2252 | IPB_NewItem_Click: | 
|---|
| 2253 | smbconfopt = samba.!tools'\smbconf.opt' | 
|---|
| 2254 | say smbconfopt | 
|---|
| 2255 | do until lines(smbconfopt) = 0 | 
|---|
| 2256 | smbconfline = linein(smbconfopt) | 
|---|
| 2257 | say smbconfline | 
|---|
| 2258 | I = I + 1 | 
|---|
| 2259 | opt.I = smbconfline | 
|---|
| 2260 | end | 
|---|
| 2261 | opt.0 = I | 
|---|
| 2262 | ok = stream(smbconfopt,'c','close') | 
|---|
| 2263 | ok = VRMethod("DDCB_Add_Voc","Reset") | 
|---|
| 2264 | ok = VRMethod("DDCB_Add_Voc","AddStringList", opt.) | 
|---|
| 2265 | ok = VRSet("DDCB_Add_Voc","Top",ObjYPos-380) | 
|---|
| 2266 | ok = VRSet("EF_Add_Voc","Top",ObjYPos-380) | 
|---|
| 2267 | ok = VRSet("PB_Add_Voc_OK","Top",ObjYPos) | 
|---|
| 2268 | ok = VRSet("PB_Add_Voc_Cancel","Top",ObjYPos) | 
|---|
| 2269 |  | 
|---|
| 2270 | ok = VRSet("DDCB_ADD_Voc","Visible",1) | 
|---|
| 2271 | ok = VRSet("EF_ADD_Voc","Visible",1) | 
|---|
| 2272 | ok = VRSet("PB_Add_Voc_OK","Visible",1) | 
|---|
| 2273 | ok = VRSet("PB_add_Voc_Cancel","Visible",1) | 
|---|
| 2274 | return | 
|---|
| 2275 |  | 
|---|
| 2276 | /*:VRX         Main_Close | 
|---|
| 2277 | */ | 
|---|
| 2278 | Main_Close: | 
|---|
| 2279 | call Quit | 
|---|
| 2280 | return | 
|---|
| 2281 |  | 
|---|
| 2282 | /*:VRX         Main_Create | 
|---|
| 2283 | */ | 
|---|
| 2284 | Main_Create: | 
|---|
| 2285 | ok = VRREdirectStdIO("ON") | 
|---|
| 2286 | options.!debug = 1 | 
|---|
| 2287 |  | 
|---|
| 2288 | call _LoadOtherFuncs | 
|---|
| 2289 |  | 
|---|
| 2290 | call _INIRead | 
|---|
| 2291 |  | 
|---|
| 2292 | call _ParseCommandLine | 
|---|
| 2293 |  | 
|---|
| 2294 | call _InitTempDir | 
|---|
| 2295 | call _SambaInit | 
|---|
| 2296 | call _SambaExtendSearchPath | 
|---|
| 2297 | call _GUIInitNLV | 
|---|
| 2298 |  | 
|---|
| 2299 | call _FindHtpasswd | 
|---|
| 2300 | call Main_Resize | 
|---|
| 2301 | call _SambaCheckComponents | 
|---|
| 2302 | call _SambaVersion | 
|---|
| 2303 | call _FindIBMLANPath | 
|---|
| 2304 | call _SmbConfTreeInit /* creates the records for default sections */ | 
|---|
| 2305 |  | 
|---|
| 2306 | /* Installation mode is triggered by a timer activated in GUIInit, when no smb.conf exists */ | 
|---|
| 2307 | call _GUIInit | 
|---|
| 2308 | return | 
|---|
| 2309 |  | 
|---|
| 2310 | /*:VRX         Main_Resize | 
|---|
| 2311 | */ | 
|---|
| 2312 | Main_Resize: | 
|---|
| 2313 | IF options.!debug == 1 THEN SAY "Main_Resize() started" | 
|---|
| 2314 | Ok = VRset("Main", "Painting", 0) | 
|---|
| 2315 |  | 
|---|
| 2316 | /*  /* Basic measurements */ | 
|---|
| 2317 | main_iwidth  = VRGet("Main","InteriorWidth")                /* Width of window client-area */ | 
|---|
| 2318 | main_iheight = VRGet("Main","InteriorHeight")               /* Height of window client-area */ | 
|---|
| 2319 |  | 
|---|
| 2320 | if main_iheight < 5500 then ok = VRSet("Main","Height",6200) | 
|---|
| 2321 | sbar_height  = VRGet("GB_STATUSBAR","Height")               /* Height of status-bar */ | 
|---|
| 2322 | split_left   = VRGet("SPLIT_Main","Left")                   /* Position of the left edge of the split-bar */ | 
|---|
| 2323 | marginx2     = margin * 2                                   /* Common margin around controls */ | 
|---|
| 2324 | pbtn_height  = 400                                          /* Height of the panels' internal button areas */ | 
|---|
| 2325 |  | 
|---|
| 2326 | pane_height  = main_iheight - sbar_height - (margin * 4)    /* Height of a split-bar panel */ | 
|---|
| 2327 | lpane_width  = split_left - margin                          /* Width of the left split-bar panel */ | 
|---|
| 2328 | rpane_width  = main_iwidth - split_left - 60 - margin       /* Width of the right split-bar panel */ */ | 
|---|
| 2329 |  | 
|---|
| 2330 | /* ab hier alt */ | 
|---|
| 2331 | ok = VRSet("GB_SmbConfTree","Top",    FWidth) | 
|---|
| 2332 | ok = VRSet("GB_SmbConfTree","Left",   FWidth-24) | 
|---|
| 2333 | ok = VRSet("GB_SmbConfTree","Height", VRGet("Main", "Height") -1350) | 
|---|
| 2334 |  | 
|---|
| 2335 | ok = VRset("GB_SmbConfTree3","Top",     FWidth) | 
|---|
| 2336 | ok = VRset("GB_SmbConfTree3","Left",    FWidth) | 
|---|
| 2337 | ok = VRset("GB_SmbConfTree3","Height",  245  ) | 
|---|
| 2338 | ok = VRset("GB_SmbConfTree3","Width",   VRGet("GB_SmbConfTree","Width") -(FWidth*2)) | 
|---|
| 2339 |  | 
|---|
| 2340 | ok = VRset("DT_SmbConfTree","Top",     8) | 
|---|
| 2341 | ok = VRset("DT_SmbConfTree","Left",    8) | 
|---|
| 2342 | ok = VRset("DT_SmbConfTree","Height",  213) | 
|---|
| 2343 | ok = VRset("DT_SmbConfTree","Width",   VRGet("GB_SmbConfTree3","Width") - 24) | 
|---|
| 2344 |  | 
|---|
| 2345 | ok = VRset("GB_SmbConfTree2","Left",   FWidth) | 
|---|
| 2346 | ok = VRset("GB_SmbConfTree2","Top",    245 + FWidth*2) | 
|---|
| 2347 | ok = VRset("GB_SmbConfTree2","Width",  VRGet("GB_SmbConfTree","Width")-FWidth*2) | 
|---|
| 2348 | ok = VRset("GB_SmbConfTree2","Height", VRGet("GB_SmbConfTree","Height")-FWidth*3-245) | 
|---|
| 2349 |  | 
|---|
| 2350 | ok = VRset("CN_SmbConf", "Top",    FWidth) | 
|---|
| 2351 | ok = VRset("CN_SmbConf", "Left",   FWidth) | 
|---|
| 2352 | ok = VRset("CN_SmbConf", "Width",  VRGet("GB_SmbConfTree2","Width") -(FWidth*2)) | 
|---|
| 2353 | ok = VRset("CN_SmbConf", "Height", VRGet("GB_SmbConfTree2","Height")-(FWidth*2)) | 
|---|
| 2354 |  | 
|---|
| 2355 | ok = VRset("GB_Help",   "Top",    FWidth) | 
|---|
| 2356 | ok = VRset("GB_Help",   "Left",   VRGet("GB_SmbConfTree","Width") + 60) | 
|---|
| 2357 | ok = VRSet("GB_Help",   "Height", VRGet("GB_SmbConfTree","Height")) | 
|---|
| 2358 | ok = VRSet("GB_Help",   "Width",  VRGet("Main", "Width") - VRGet("GB_SmbConfTree","width") - 60- FWidth*2-24*2) | 
|---|
| 2359 |  | 
|---|
| 2360 | ok = VRset("GB_Help3","Top",     FWidth) | 
|---|
| 2361 | ok = VRset("GB_Help3","Left",    FWidth) | 
|---|
| 2362 | ok = VRset("GB_Help3","Height",  245  ) | 
|---|
| 2363 | ok = VRset("GB_Help3","Width",   VRGet("GB_Help","Width") -(FWidth*2)) | 
|---|
| 2364 |  | 
|---|
| 2365 | ok = VRset("GB_Help2","Left",   FWidth) | 
|---|
| 2366 | ok = VRset("GB_Help2","Top",    245 + FWidth*2) | 
|---|
| 2367 | ok = VRset("GB_Help2","Width",  VRGet("GB_Help","Width")-FWidth*2) | 
|---|
| 2368 | ok = VRset("GB_Help2","Height", VRGet("GB_Help","Height")-FWidth*3-245) | 
|---|
| 2369 |  | 
|---|
| 2370 | ok = VRset("DT_Help","Top",     8) | 
|---|
| 2371 | ok = VRset("DT_Help","Left",    8) | 
|---|
| 2372 | ok = VRset("DT_Help","Height",  213) | 
|---|
| 2373 | ok = VRset("DT_Help","Width",   VRGet("GB_Help3","Width") - 24) | 
|---|
| 2374 |  | 
|---|
| 2375 | ok = VRset("GB_Shares",   "Top",    FWidth) | 
|---|
| 2376 | ok = VRset("GB_Shares",   "Left",   VRGet("GB_SmbConfTree","Width") + 60) | 
|---|
| 2377 | ok = VRSet("GB_Shares",   "Height", VRGet("GB_SmbConfTree","Height")) | 
|---|
| 2378 | ok = VRSet("GB_Shares",   "Width",  VRGet("Main", "Width") - VRGet("GB_SmbConfTree","width") - 60- FWidth*2-24*2) | 
|---|
| 2379 |  | 
|---|
| 2380 | ok = VRset("GB_Shares3","Top",     FWidth) | 
|---|
| 2381 | ok = VRset("GB_Shares3","Left",    FWidth) | 
|---|
| 2382 | ok = VRset("GB_Shares3","Height",  245  ) | 
|---|
| 2383 | ok = VRset("GB_Shares3","Width",   VRGet("GB_Shares","Width") -(FWidth*2)) | 
|---|
| 2384 |  | 
|---|
| 2385 | ok = VRset("GB_Shares2","Left",   FWidth) | 
|---|
| 2386 | ok = VRset("GB_Shares2","Top",    245 + FWidth*2) | 
|---|
| 2387 | ok = VRset("GB_Shares2","Width",  VRGet("GB_Shares","Width")-FWidth*2) | 
|---|
| 2388 | ok = VRset("GB_Shares2","Height", VRGet("GB_Shares","Height")-FWidth*3-245) | 
|---|
| 2389 |  | 
|---|
| 2390 | ok = VRset("DT_Shares", "Top",    8) | 
|---|
| 2391 | ok = VRset("DT_Shares", "Left",   8) | 
|---|
| 2392 | ok = VRset("DT_Shares", "Height", 213) | 
|---|
| 2393 | ok = VRset("DT_Shares", "Width",  VRGet("GB_Shares3","Width") - 24) | 
|---|
| 2394 |  | 
|---|
| 2395 | ok = VRSet("GB_Global", "Height", VRGet("GB_SmbConfTree","Height")) | 
|---|
| 2396 | ok = VRSet("GB_Global", "Width",  VRGet("GB_Shares",     "Width")) | 
|---|
| 2397 |  | 
|---|
| 2398 | MButton.bTop   = VRGet("GB_SmbConfTree","height")+FWidth*2 | 
|---|
| 2399 | MButton.bLeft  = VRGet("GB_Shares","Left") | 
|---|
| 2400 | MButton.bWidth = VRGet("PB_Save","Width") | 
|---|
| 2401 |  | 
|---|
| 2402 | if MButton.bTop < 1300 & MButton.bLeft < 1300 then do | 
|---|
| 2403 | MButton.bTop = 4842 | 
|---|
| 2404 | MButton.bLeft = 3758 | 
|---|
| 2405 | MButton.bWidth = 1241 | 
|---|
| 2406 | FWidth = 32 | 
|---|
| 2407 | end | 
|---|
| 2408 |  | 
|---|
| 2409 | ok = VRSet("PB_Reload", "Top",    MButton.bTop) | 
|---|
| 2410 | ok = VRSet("PB_Reload", "Left",   MButton.bLeft) | 
|---|
| 2411 | ok = VRSet("PB_Reload", "Width",  MButton.bWidth) | 
|---|
| 2412 |  | 
|---|
| 2413 | ok = VRSet("PB_Save", "Top",    MButton.bTop) | 
|---|
| 2414 | ok = VRSet("PB_Save", "Left",   MButton.bLeft+1*FWidth+MButton.bWidth) | 
|---|
| 2415 | ok = VRSet("PB_Reload", "Width",  MButton.bWidth) | 
|---|
| 2416 |  | 
|---|
| 2417 | ok = VRSet("PB_Undo",   "Top",    MButton.bTop) | 
|---|
| 2418 | ok = VRSet("PB_Undo",   "Left",   MButton.bLeft+2*FWidth+MButton.bWidth*2) | 
|---|
| 2419 | ok = VRSet("PB_Undo",   "Width",  MButton.bWidth) | 
|---|
| 2420 |  | 
|---|
| 2421 | ok = VRSet("PB_Cancel", "Top",    MButton.bTop) | 
|---|
| 2422 | ok = VRSet("PB_Cancel", "Left",   MButton.bLeft+3*FWidth+MButton.bWidth*3) | 
|---|
| 2423 | ok = VRSet("PB_Cancel", "Width",  MButton.bWidth) | 
|---|
| 2424 |  | 
|---|
| 2425 | /* ok = VRSet("PB_Help",   "Top",    MButton.bTop) | 
|---|
| 2426 | ok = VRSet("PB_Help",   "Left",   MButton.bLeft+6*FWidth+MButton.bWidth*3) | 
|---|
| 2427 | ok = VRSet("PB_Help",   "Width",  MButton.bWidth) */ | 
|---|
| 2428 |  | 
|---|
| 2429 | drop MButton.b | 
|---|
| 2430 |  | 
|---|
| 2431 | Top    = VRGet("Main","Top") | 
|---|
| 2432 | Left   = VRGet("Main","Left") | 
|---|
| 2433 | Width  = VRGet("Main","Width") | 
|---|
| 2434 | Height = VRGet("Main","Height") | 
|---|
| 2435 |  | 
|---|
| 2436 | if ActiveGroup = "Global" then do | 
|---|
| 2437 |  | 
|---|
| 2438 | end | 
|---|
| 2439 | IF options.!debug == 1 THEN SAY "  Window size = "VRGet("Main","Width")', 'VRGet("Main","Height") | 
|---|
| 2440 |  | 
|---|
| 2441 | /* check and empty event queue, trash spurious resize events */ | 
|---|
| 2442 | EventString = '' | 
|---|
| 2443 | TrashedResize = 0 | 
|---|
| 2444 | do until EventString = 'nop' | 
|---|
| 2445 | EventString = VREvent('N') | 
|---|
| 2446 | say '  Event: "'EventString'" ('TrashedResize')' | 
|---|
| 2447 | if EventString <> 'nop' then do | 
|---|
| 2448 | if EventString = 'CALL Main_Resize' then TrashedResize = TrashedResize + 1 | 
|---|
| 2449 | else interpret eventString | 
|---|
| 2450 | end | 
|---|
| 2451 | end | 
|---|
| 2452 | if TrashedResize >= 2 then CALL Main_Resize | 
|---|
| 2453 |  | 
|---|
| 2454 | IF options.!debug == 1 THEN SAY "  Window size = "VRGet("Main","Width")', 'VRGet("Main","Height") | 
|---|
| 2455 | Ok = VRset("Main", "Painting", 1) | 
|---|
| 2456 | IF options.!debug == 1 THEN SAY "Main_Resize() done" | 
|---|
| 2457 | return | 
|---|
| 2458 |  | 
|---|
| 2459 | /*:VRX         Menu_Action_AddHomes_Click | 
|---|
| 2460 | */ | 
|---|
| 2461 | Menu_Action_AddHomes_Click: | 
|---|
| 2462 | call _SmbConfDefault_Homes | 
|---|
| 2463 | call _SmbConfTreeInit | 
|---|
| 2464 | call _SmbConfLoad | 
|---|
| 2465 | return | 
|---|
| 2466 |  | 
|---|
| 2467 | /*:VRX         Menu_Action_AddNetLogon_Click | 
|---|
| 2468 | */ | 
|---|
| 2469 | Menu_Action_AddNetLogon_Click: | 
|---|
| 2470 | call _SmbConfDefault_Netlogon | 
|---|
| 2471 | call _SmbConfTreeInit | 
|---|
| 2472 | call _SmbConfLoad | 
|---|
| 2473 | return | 
|---|
| 2474 |  | 
|---|
| 2475 | /*:VRX         Menu_Action_AddProfiles_Click | 
|---|
| 2476 | */ | 
|---|
| 2477 | Menu_Action_AddProfiles_Click: | 
|---|
| 2478 | call _SmbConfDefault_Profiles | 
|---|
| 2479 | call _SmbConfTreeInit | 
|---|
| 2480 | call _SmbConfLoad | 
|---|
| 2481 | return | 
|---|
| 2482 |  | 
|---|
| 2483 | /*:VRX         Menu_Action_EraseTransient_Click | 
|---|
| 2484 | */ | 
|---|
| 2485 | Menu_Action_EraseTransient_Click: | 
|---|
| 2486 | if _SambaRunning() then do | 
|---|
| 2487 | Msg.Text = NLVGetMessage(70) | 
|---|
| 2488 | Msg.Type = "E" | 
|---|
| 2489 | ok = _ShowMsg() | 
|---|
| 2490 | return | 
|---|
| 2491 | end | 
|---|
| 2492 |  | 
|---|
| 2493 | ok = VRMethod("CN_smbconf","SetRecordAttr", smbconf.!global, "Selected", 1) | 
|---|
| 2494 | call CN_smbconf_Click | 
|---|
| 2495 |  | 
|---|
| 2496 | if VRIsValidObject( "EF_LOCK_DIRECTORY" ) then do | 
|---|
| 2497 | LockDir = VRGet("EF_Lock_Directory","Value") | 
|---|
| 2498 | Msg.Text = NLVGetMessage(71) | 
|---|
| 2499 | Msg.Type = "Q" | 
|---|
| 2500 | ok = _MsgYesNo() | 
|---|
| 2501 | if ok <> 1 then return | 
|---|
| 2502 |  | 
|---|
| 2503 | ok = SysFileDelete(LockDir"\gencache.tdb") | 
|---|
| 2504 | ok = SysFileDelete(LockDir"\brlock.tdb") | 
|---|
| 2505 | ok = SysFileDelete(LockDir"\unexpected.tdb") | 
|---|
| 2506 | ok = SysFileDelete(LockDir"\connections.tdb") | 
|---|
| 2507 | ok = SysFileDelete(LockDir"\locking.tdb") | 
|---|
| 2508 | ok = SysFileDelete(LockDir"\messages.tdb") | 
|---|
| 2509 | end | 
|---|
| 2510 | return | 
|---|
| 2511 |  | 
|---|
| 2512 | /*:VRX         Menu_File_Debug_Click | 
|---|
| 2513 | */ | 
|---|
| 2514 | Menu_File_Debug_Click: | 
|---|
| 2515 | options.!debug = VRGet("Menu_File_debug","Checked") | 
|---|
| 2516 |  | 
|---|
| 2517 | /* The following 2 lines are unnecessary for a checkbox ! */ | 
|---|
| 2518 | ok = VRSet("Menu_File_debug","Checked",\options.!debug) | 
|---|
| 2519 | options.!debug = \options.!debug | 
|---|
| 2520 |  | 
|---|
| 2521 | if options.!debug | 
|---|
| 2522 | then ok = VRRedirectStdIO("On") | 
|---|
| 2523 | else ok = VRRedirectStdIO("OFF") | 
|---|
| 2524 |  | 
|---|
| 2525 | return | 
|---|
| 2526 |  | 
|---|
| 2527 | /*:VRX         Menu_File_Exit_Click | 
|---|
| 2528 | */ | 
|---|
| 2529 | Menu_File_Exit_Click: | 
|---|
| 2530 | call Quit | 
|---|
| 2531 | return | 
|---|
| 2532 |  | 
|---|
| 2533 | /*:VRX         Menu_File_Import_IBMPeer_Click | 
|---|
| 2534 | */ | 
|---|
| 2535 | Menu_File_Import_IBMPeer_Click: | 
|---|
| 2536 | call _SmbConfMigratePeer | 
|---|
| 2537 | ok = SysFileTree(smbconf,exist.,'FO') | 
|---|
| 2538 | SmbConfExists = exist.0 | 
|---|
| 2539 | call _SmbConfTreeReset | 
|---|
| 2540 | return | 
|---|
| 2541 |  | 
|---|
| 2542 | /*:VRX         Menu_File_ImportHosts_Click | 
|---|
| 2543 | */ | 
|---|
| 2544 | Menu_File_ImportHosts_Click: | 
|---|
| 2545 | if VRFileExists(ETC'\samba\lmhosts') then do | 
|---|
| 2546 | Msg.Text = NLVGetMessage(56, ETC'\samba\lmhosts') | 
|---|
| 2547 | Msg.Type = 'Q' | 
|---|
| 2548 | if _MsgYesNo() = 1 then do | 
|---|
| 2549 | call _LMHostsImport | 
|---|
| 2550 | end | 
|---|
| 2551 | end | 
|---|
| 2552 | else call _LMHostsImport | 
|---|
| 2553 | return | 
|---|
| 2554 |  | 
|---|
| 2555 | /*:VRX         Menu_File_PrintCap_Click | 
|---|
| 2556 | */ | 
|---|
| 2557 | Menu_File_PrintCap_Click: | 
|---|
| 2558 | call _PrintcapCreate | 
|---|
| 2559 | Msg.Text = NLVGetMessage(50, samba.!printcap) | 
|---|
| 2560 | msg.Type = 'I' | 
|---|
| 2561 | call _ShowMsg | 
|---|
| 2562 | return | 
|---|
| 2563 |  | 
|---|
| 2564 | /*:VRX         Menu_File_reset_Click | 
|---|
| 2565 | */ | 
|---|
| 2566 | Menu_File_reset_Click: | 
|---|
| 2567 | call _SmbConfCreateDefault | 
|---|
| 2568 | ok = SysFileTree(smbconf,exist.,'FO') | 
|---|
| 2569 | SmbConfExists = exist.0 | 
|---|
| 2570 | call _SmbConfTreeReset | 
|---|
| 2571 | return | 
|---|
| 2572 |  | 
|---|
| 2573 | /*:VRX         Menu_File_SmbUpdate_Click | 
|---|
| 2574 | */ | 
|---|
| 2575 | Menu_File_SmbUpdate_Click: | 
|---|
| 2576 | BuildFile = VRFileDialog( VRWindow(), NLVGetMessage(64), "Open", options.!builddir"\samba-*zip", , ,  ) | 
|---|
| 2577 | if BuildFile = '' then return | 
|---|
| 2578 | options.!builddir = VRParseFilename(buildfile,'DP') | 
|---|
| 2579 | address CMD samba.!smbcmd' stop' | 
|---|
| 2580 | OldDir = Directory(Strip(samba.!bin,'T','\')) | 
|---|
| 2581 | ok = VRRedirectStdIO('ON') | 
|---|
| 2582 | address cmd 'unzip.exe -oCj 'BuildFile' *.exe *.dll' | 
|---|
| 2583 | say 'unzip RC = 'RC | 
|---|
| 2584 | if RC <> 0 then address cmd 'PAUSE' | 
|---|
| 2585 | IF options.!debug <> 1 THEN ok = VRRedirectStdIO('OFF') | 
|---|
| 2586 | ok = directory(OldDir) | 
|---|
| 2587 | call _SambaVersion | 
|---|
| 2588 | ok = VRSet("EF_Binaries_Version","value",samba.!version) | 
|---|
| 2589 | address CMD samba.!smbcmd' start' | 
|---|
| 2590 | return | 
|---|
| 2591 |  | 
|---|
| 2592 | /*:VRX         Menu_Help_About_Click | 
|---|
| 2593 | */ | 
|---|
| 2594 | Menu_Help_About_Click: | 
|---|
| 2595 | say '  'samba.!smbd' -V --debuglevel=0 2>'samba.!error' 1>'smboutput | 
|---|
| 2596 | address cmd samba.!smbd' -V --debuglevel=0 2>'samba.!error' 1>'smboutput | 
|---|
| 2597 |  | 
|---|
| 2598 | SambaVer = "Samba "||strip(linein(smboutput)) | 
|---|
| 2599 | ok = stream(smboutput,'c','close') | 
|---|
| 2600 |  | 
|---|
| 2601 | window = VRLoadSecondary( "About", "W" ) | 
|---|
| 2602 | return | 
|---|
| 2603 |  | 
|---|
| 2604 | /*:VRX         Menu_Options_ExportMode_Click | 
|---|
| 2605 | */ | 
|---|
| 2606 | Menu_Options_ExportMode_Click: | 
|---|
| 2607 | say 'ExpertMode_Click started' | 
|---|
| 2608 | say         samba.!testparmexe' -v -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm' | 
|---|
| 2609 | address cmd samba.!testparmexe' -v -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm' | 
|---|
| 2610 | say 'VRCopyFile('TempDir'smb.conf, 'smbconf' )' | 
|---|
| 2611 | say "  smb.conf Gráe: "stream(smbconf,'c','QUERY SIZE') | 
|---|
| 2612 | ok = VRCopyFile( TempDir'smb.conf', smbconf ) | 
|---|
| 2613 | say "  smb.conf Gráe: "stream(smbconf,'c','QUERY SIZE') | 
|---|
| 2614 | say 'Copy ok ='ok' (1 = success, 0 = failure)' | 
|---|
| 2615 | call _SmbConfTreeReset | 
|---|
| 2616 | call Main_Resize | 
|---|
| 2617 | say 'ExpertMode_Click done' | 
|---|
| 2618 | return | 
|---|
| 2619 |  | 
|---|
| 2620 | /*:VRX         Menu_Options_MiniIcons_Click | 
|---|
| 2621 | */ | 
|---|
| 2622 | Menu_Options_MiniIcons_Click: | 
|---|
| 2623 | advanced.!bigicons = \advanced.!bigicons | 
|---|
| 2624 | ok = VRset("CN_SMBCONF", "MiniIcons", \advanced.!bigicons) | 
|---|
| 2625 | ok = VRset("Menu_Options_MiniIcons",  "Checked", \advanced.!bigicons) | 
|---|
| 2626 | return | 
|---|
| 2627 |  | 
|---|
| 2628 | /*:VRX         Menu_Options_SimpleMode_Click | 
|---|
| 2629 | */ | 
|---|
| 2630 | Menu_Options_SimpleMode_Click: | 
|---|
| 2631 | say 'SimpleMode_Click started' | 
|---|
| 2632 |  | 
|---|
| 2633 | /* Workaround for testparm bugs */ | 
|---|
| 2634 | say 'VRCopyFile('smbconf', 'TempDir'smb.conf )' | 
|---|
| 2635 | ok = VRCopyFile( smbconf, TempDir'smb.conf') | 
|---|
| 2636 | call _SmbConfCommitChanges | 
|---|
| 2637 |  | 
|---|
| 2638 | say samba.!testparmexe' -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm' | 
|---|
| 2639 | address cmd samba.!testparmexe' -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm' | 
|---|
| 2640 | NewSize = stream(TempDir"smb.conf",'c','QUERY SIZE') | 
|---|
| 2641 | say "  "TempDir"smb.conf Gráe: "NewSize | 
|---|
| 2642 | if NewSize = 0 then 'pause' | 
|---|
| 2643 | say "  smb.conf Gráe: "stream(smbconf,'c','QUERY SIZE') | 
|---|
| 2644 | say 'VRCopyFile('TempDir'smb.conf, 'smbconf' )' | 
|---|
| 2645 | ok = VRCopyFile( TempDir'smb.conf' , smbconf ) | 
|---|
| 2646 | say "  smb.conf Gráe: "stream(smbconf,'c','QUERY SIZE') | 
|---|
| 2647 | say 'Copy ok ='ok' (1 = success, 0 = failure)' | 
|---|
| 2648 | call _SmbConfTreeReset | 
|---|
| 2649 | do I = Page to 3 by -1 | 
|---|
| 2650 | ok = VRMethod( "GB_Global", "DeletePage", I  ) | 
|---|
| 2651 | ok = VRDestroy("GL_GLOBAL_"I) | 
|---|
| 2652 | end | 
|---|
| 2653 | Page = 2 | 
|---|
| 2654 | call Main_resize | 
|---|
| 2655 | say 'SimpleMode_Click done' | 
|---|
| 2656 | return | 
|---|
| 2657 |  | 
|---|
| 2658 | /*:VRX         Menu_ShareContext_Add_Click | 
|---|
| 2659 | */ | 
|---|
| 2660 | Menu_ShareContext_Add_Click: | 
|---|
| 2661 | NewShareDir = _dirDialog() | 
|---|
| 2662 | if NewShareDir = "" then return | 
|---|
| 2663 | NewShareName = filespec("N",NewShareDir) | 
|---|
| 2664 | Buttons.1 = "OK" | 
|---|
| 2665 | Buttons.2 = "Abort" | 
|---|
| 2666 | Buttons.0 = 2 | 
|---|
| 2667 | id = VRPrompt( VRWindow(), "Enter name for new share", "NewShareName", "Add new Samba share", "Buttons.", buttons.1, buttons.2 ) | 
|---|
| 2668 | if ID = 2 | NewShareName = "" then return | 
|---|
| 2669 | NewShareHandle = VRMethod( "CN_smbconf", "AddRecord", smbconf.!dirs,, NewShareName,"#4") | 
|---|
| 2670 | call lineout smbconf, '['NewShareName']' | 
|---|
| 2671 | call lineout smbconf, Indent||'path = '_bs2fs(NewShareDir) | 
|---|
| 2672 | call lineout smbconf, Indent||'comment = 'NewShareName' directory' | 
|---|
| 2673 | call lineout smbconf, Indent||'browseable = Yes' | 
|---|
| 2674 | call lineout smbconf, Indent||'read only = Yes' | 
|---|
| 2675 | call lineout smbconf, Indent||'hide files = /*.?SF/' | 
|---|
| 2676 | call lineout smbconf | 
|---|
| 2677 | call _SmbConfTreeReset | 
|---|
| 2678 | Msg.Text = NLVGetMessage(69) | 
|---|
| 2679 | Msg.Type = 'I' | 
|---|
| 2680 | call _ShowMsg | 
|---|
| 2681 | ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs, "Collapsed", 0 ) | 
|---|
| 2682 | ok = VRMethod("CN_smbconf","SetRecordAttr",NewShareHandle, "Selected", 1 ) | 
|---|
| 2683 | return | 
|---|
| 2684 |  | 
|---|
| 2685 | /*:VRX         Menu_ShareContext_AddPrinter_Click | 
|---|
| 2686 | */ | 
|---|
| 2687 | Menu_ShareContext_AddPrinter_Click: | 
|---|
| 2688 | AbortPrinter = 1 | 
|---|
| 2689 | window = VRLoadSecondary( "PrinterSelection", "W" ) | 
|---|
| 2690 | if AbortPrinter then return | 
|---|
| 2691 | parse var SharePrinter PrinterName';'PrinterQueue';'PrinterDriver | 
|---|
| 2692 | NewShareHandle = VRMethod( "CN_smbconf", "AddRecord", smbconf.!printers,, PrinterQueue,"#4") | 
|---|
| 2693 | call lineout smbconf, '['PrinterQueue']' | 
|---|
| 2694 | call lineout smbconf, Indent||'path = '_bs2fs(ETC'\samba\spool\'printerqueue) | 
|---|
| 2695 | ok = SysMkDir(ETC'\samba\spool\'printerqueue) | 
|---|
| 2696 | call lineout smbconf, Indent||'comment = 'Printername | 
|---|
| 2697 | call lineout smbconf, Indent||'create mask = 0700' | 
|---|
| 2698 | call lineout smbconf, Indent||'printer name = 'printerqueue | 
|---|
| 2699 | call lineout smbconf, Indent||'printing = os2' | 
|---|
| 2700 | call lineout smbconf, Indent||'printable = Yes' | 
|---|
| 2701 | call lineout smbconf, Indent||'print command = 'samba.!bin'\smbprint.exe "%s" "%p" "%J" "%c" "%z"' | 
|---|
| 2702 | call lineout smbconf, Indent||'browseable = Yes' | 
|---|
| 2703 | call lineout smbconf, Indent||'guest ok = Yes' | 
|---|
| 2704 | call lineout smbconf, Indent||'read only = No' | 
|---|
| 2705 | call lineout smbconf | 
|---|
| 2706 | call _SmbConfTreeReset | 
|---|
| 2707 | Msg.Text = NLVGetMessage(69) | 
|---|
| 2708 | Msg.Type = 'I' | 
|---|
| 2709 | call _ShowMsg | 
|---|
| 2710 | ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "Collapsed", 0 ) | 
|---|
| 2711 | ok = VRMethod("CN_smbconf","SetRecordAttr",NewShareHandle, "Selected", 1 ) | 
|---|
| 2712 | return | 
|---|
| 2713 |  | 
|---|
| 2714 | /*:VRX         Menu_ShareContext_Remove_Click | 
|---|
| 2715 | */ | 
|---|
| 2716 | Menu_ShareContext_Remove_Click: | 
|---|
| 2717 | call _SmbConfShareRemove | 
|---|
| 2718 | if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs, "Collapsed", 0 ) | 
|---|
| 2719 | return | 
|---|
| 2720 |  | 
|---|
| 2721 | /*:VRX         Menu_ShareContext_RemovePrinter_Click | 
|---|
| 2722 | */ | 
|---|
| 2723 | Menu_ShareContext_RemovePrinter_Click: | 
|---|
| 2724 | call _SmbConfShareRemove | 
|---|
| 2725 | if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "Collapsed", 0 ) | 
|---|
| 2726 | return | 
|---|
| 2727 |  | 
|---|
| 2728 | /*:VRX         Menu_ShareContext_Rename_Click | 
|---|
| 2729 | */ | 
|---|
| 2730 | Menu_ShareContext_Rename_Click: | 
|---|
| 2731 | call _SmbConfShareRename | 
|---|
| 2732 | if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!dirs, "Collapsed", 0 ) | 
|---|
| 2733 | return | 
|---|
| 2734 |  | 
|---|
| 2735 | /*:VRX         Menu_ShareContext_RenamePrinter_Click | 
|---|
| 2736 | */ | 
|---|
| 2737 | Menu_ShareContext_RenamePrinter_Click: | 
|---|
| 2738 | call _SmbConfShareRename | 
|---|
| 2739 | if \Aborted then ok = VRMethod("CN_smbconf","SetRecordAttr",smbconf.!printers, "Collapsed", 0 ) | 
|---|
| 2740 | return | 
|---|
| 2741 |  | 
|---|
| 2742 | /*:VRX         PB_1_Click | 
|---|
| 2743 | */ | 
|---|
| 2744 | PB_1_Click: | 
|---|
| 2745 | ok = VRREdirectStdIO("ON") | 
|---|
| 2746 | Buttons.1 = NLVGetMessage(2) | 
|---|
| 2747 | Buttons.2 = NLVGetMessage(3) | 
|---|
| 2748 | Buttons.0 = 2 | 
|---|
| 2749 | command = 'd:\samba\smbpasswd.exe' | 
|---|
| 2750 | id = VRPrompt( VRWindow(), "Console", "command", "Console", "Buttons.", buttons.1, buttons.2 ) | 
|---|
| 2751 | if id = 2 then return | 
|---|
| 2752 | say command | 
|---|
| 2753 | address cmd command | 
|---|
| 2754 | /* samba.!netexe' rpc 'command' 'DebugLevel' 'UserCred' 2>'samba.!error' 1>'samba.!msg */ | 
|---|
| 2755 | /* if RC <> 0 then call _SambaShowError; else call _SambaShowMsg */ | 
|---|
| 2756 | return | 
|---|
| 2757 |  | 
|---|
| 2758 | /*:VRX         PB_AboutOK_Click | 
|---|
| 2759 | */ | 
|---|
| 2760 | PB_AboutOK_Click: | 
|---|
| 2761 | call About_Close | 
|---|
| 2762 | return | 
|---|
| 2763 |  | 
|---|
| 2764 | /*:VRX         PB_Add_Voc_Cancel_Click | 
|---|
| 2765 | */ | 
|---|
| 2766 | PB_Add_Voc_Cancel_Click: | 
|---|
| 2767 | drop opt. | 
|---|
| 2768 | ok = VRSet("DDCB_Add_Voc","Value","") | 
|---|
| 2769 | ok = VRSet("EF_Add_Voc", "Value","") | 
|---|
| 2770 |  | 
|---|
| 2771 | ok = VRSet("DDCB_ADD_Voc","Visible",0) | 
|---|
| 2772 | ok = VRSet("EF_ADD_Voc","Visible",0) | 
|---|
| 2773 | ok = VRSet("PB_Add_Voc_OK","Visible",0) | 
|---|
| 2774 | ok = VRSet("PB_add_Voc_Cancel","Visible",0) | 
|---|
| 2775 | return | 
|---|
| 2776 |  | 
|---|
| 2777 | /*:VRX         PB_Add_Voc_OK_Click | 
|---|
| 2778 | */ | 
|---|
| 2779 | PB_Add_Voc_OK_Click: | 
|---|
| 2780 | NewVoc = VRGet("DDCB_Add_Voc","Value") | 
|---|
| 2781 | NewValue=VRGet("EF_Add_Voc", "Value") | 
|---|
| 2782 | call IniSet NewVoc, NewValue, CurSection, samba.!smbconf | 
|---|
| 2783 | drop opt. | 
|---|
| 2784 | ok = VRSet("DDCB_Add_Voc","Value","") | 
|---|
| 2785 | ok = VRSet("EF_Add_Voc", "Value","") | 
|---|
| 2786 | ok = VRSet("DDCB_ADD_Voc","Visible",0) | 
|---|
| 2787 | ok = VRSet("EF_ADD_Voc","Visible",0) | 
|---|
| 2788 | ok = VRSet("PB_Add_Voc_OK","Visible",0) | 
|---|
| 2789 | ok = VRSet("PB_add_Voc_Cancel","Visible",0) | 
|---|
| 2790 |  | 
|---|
| 2791 | call Menu_Options_SimpleMode_Click | 
|---|
| 2792 | return | 
|---|
| 2793 |  | 
|---|
| 2794 | /*:VRX         PB_Cancel_Click | 
|---|
| 2795 | */ | 
|---|
| 2796 | PB_Cancel_Click: | 
|---|
| 2797 | IF options.!debug == 1 THEN say 'PB_Cancel_Click() started' | 
|---|
| 2798 | if VRGet("PB_Save","Enabled") then call PB_Save_Click | 
|---|
| 2799 | 'pause' | 
|---|
| 2800 | call Quit | 
|---|
| 2801 | IF options.!debug == 1 THEN say 'PB_Cancel_Click() done' | 
|---|
| 2802 | return | 
|---|
| 2803 |  | 
|---|
| 2804 | /*:VRX         PB_Help_Click | 
|---|
| 2805 | */ | 
|---|
| 2806 | PB_Help_Click: | 
|---|
| 2807 |  | 
|---|
| 2808 | return | 
|---|
| 2809 |  | 
|---|
| 2810 | /*:VRX         PB_Install_Default_Click | 
|---|
| 2811 | */ | 
|---|
| 2812 | PB_Install_Default_Click: | 
|---|
| 2813 | if VRGet("EF_Workgroup_Initial","Value") = "" then return | 
|---|
| 2814 |  | 
|---|
| 2815 | if \VRGet("CB_NoRoot","Set") then do | 
|---|
| 2816 | if \_SambaRootPWCheck() then return | 
|---|
| 2817 | end | 
|---|
| 2818 |  | 
|---|
| 2819 | call _SmbConfCreateDefault | 
|---|
| 2820 | /* call _Smb35Init */ | 
|---|
| 2821 | ok = SysFileTree(smbconf,exist.,'FO') | 
|---|
| 2822 | SmbConfExists = exist.0 | 
|---|
| 2823 | call _SmbConfBackup | 
|---|
| 2824 | call _SmbConfTreeReset | 
|---|
| 2825 |  | 
|---|
| 2826 | if \VRGet("CB_NoRoot","Set") then do | 
|---|
| 2827 | call _SambaRootPWSet | 
|---|
| 2828 | end | 
|---|
| 2829 | call _SambaGuestCreate | 
|---|
| 2830 |  | 
|---|
| 2831 | call _SambaUserCreate | 
|---|
| 2832 | ok = VRSet("Main", 'Pointer', 'WAIT' ) | 
|---|
| 2833 | call _SambaGroupMapInst | 
|---|
| 2834 | ok = VRSet("Main", 'Pointer', '<default>' ) | 
|---|
| 2835 | /* call Menu_File_ImportHosts_Click */ | 
|---|
| 2836 |  | 
|---|
| 2837 | call Installer_Close | 
|---|
| 2838 | return | 
|---|
| 2839 |  | 
|---|
| 2840 | /*:VRX         PB_Install_Migration_Click | 
|---|
| 2841 | */ | 
|---|
| 2842 | PB_Install_Migration_Click: | 
|---|
| 2843 | if VRGet("EF_Workgroup_Initial","Value") = "" then return | 
|---|
| 2844 |  | 
|---|
| 2845 | if \VRGet("CB_NoRoot","Set") then do | 
|---|
| 2846 | if \_SambaRootPWCheck() then return | 
|---|
| 2847 | end | 
|---|
| 2848 |  | 
|---|
| 2849 |  | 
|---|
| 2850 | call _SmbConfMigratePeer | 
|---|
| 2851 | ok = SysFileTree(smbconf,exist.,'FO') | 
|---|
| 2852 | SmbConfExists = exist.0 | 
|---|
| 2853 | call _SmbConfBackup | 
|---|
| 2854 | call _SmbConfTreeReset | 
|---|
| 2855 | if \VRGet("CB_NoRoot","Set") then do | 
|---|
| 2856 | call _SambaRootPWSet | 
|---|
| 2857 | end | 
|---|
| 2858 | call _SambaGuestCreate | 
|---|
| 2859 |  | 
|---|
| 2860 | call _SambaUserCreate | 
|---|
| 2861 | ok = VRSet("Main", 'Pointer', 'WAIT' ) | 
|---|
| 2862 | call _SambaGroupMapInst | 
|---|
| 2863 | ok = VRSet("Main", 'Pointer', '<default>' ) | 
|---|
| 2864 |  | 
|---|
| 2865 | /*  call Menu_File_ImportHosts_Click */ | 
|---|
| 2866 |  | 
|---|
| 2867 | call Installer_Close | 
|---|
| 2868 | return | 
|---|
| 2869 |  | 
|---|
| 2870 | /*:VRX         PB_Printer_Abort_Click | 
|---|
| 2871 | */ | 
|---|
| 2872 | PB_Printer_Abort_Click: | 
|---|
| 2873 | call PrinterSelection_Close | 
|---|
| 2874 | return | 
|---|
| 2875 |  | 
|---|
| 2876 | /*:VRX         PB_Printer_OK_Click | 
|---|
| 2877 | */ | 
|---|
| 2878 | PB_Printer_OK_Click: | 
|---|
| 2879 | SharePrinter = RawPrinter(VRGet("LB_Printers","SelectedString")) | 
|---|
| 2880 | AbortPrinter = 0 | 
|---|
| 2881 | say SharePrinter | 
|---|
| 2882 | call PrinterSelection_Close | 
|---|
| 2883 | return | 
|---|
| 2884 |  | 
|---|
| 2885 | RawPrinter: | 
|---|
| 2886 | do I = 1 to printer.0 until PurePrinter(printer.I) = arg(1) | 
|---|
| 2887 | end | 
|---|
| 2888 | return printer.I | 
|---|
| 2889 | /*:VRX         PB_Reload_Click | 
|---|
| 2890 | */ | 
|---|
| 2891 | PB_Reload_Click: | 
|---|
| 2892 | call PB_Save_Click | 
|---|
| 2893 | call beep 960, 1 | 
|---|
| 2894 | address CMD samba.!smbcmd' reload' | 
|---|
| 2895 | return | 
|---|
| 2896 |  | 
|---|
| 2897 | /*:VRX         PB_RemoveContinue_Click | 
|---|
| 2898 | */ | 
|---|
| 2899 | PB_RemoveContinue_Click: | 
|---|
| 2900 |  | 
|---|
| 2901 | if VRGet("CB_RemoveSmbConf","set") then do | 
|---|
| 2902 | ok = SysFileDelete(samba.!smbconf) | 
|---|
| 2903 | SmbConfExists = 0 | 
|---|
| 2904 | Installmode = 1 | 
|---|
| 2905 | end | 
|---|
| 2906 | else Installmode = 0 | 
|---|
| 2907 |  | 
|---|
| 2908 | if VRGet("CB_RemoveBackend","set") then do | 
|---|
| 2909 | ok = SysFileTree(ETC"\samba\*.?db",xdb.,'FOS') | 
|---|
| 2910 | do I = 1 to xdb.0 | 
|---|
| 2911 | ok = SysFileDelete(xdb.I) | 
|---|
| 2912 | if ok <> 0 then do | 
|---|
| 2913 | Msg.Text = "Error "ok" deleting "xdb.I"!" | 
|---|
| 2914 | Msg.Type = "W" | 
|---|
| 2915 | call _ShowMsg | 
|---|
| 2916 | end | 
|---|
| 2917 | end | 
|---|
| 2918 | end | 
|---|
| 2919 | if VRGet("CB_RemoveLMHosts","set") then do | 
|---|
| 2920 | call _LMHostsImport | 
|---|
| 2921 | end | 
|---|
| 2922 |  | 
|---|
| 2923 | call RemoveConfig_Close | 
|---|
| 2924 | return | 
|---|
| 2925 |  | 
|---|
| 2926 | /*:VRX         PB_Save_Click | 
|---|
| 2927 | */ | 
|---|
| 2928 | PB_Save_Click: | 
|---|
| 2929 | IF options.!debug == 1 THEN say 'PB_Save_Click() started' | 
|---|
| 2930 | if ValueChanged then do | 
|---|
| 2931 | if CurSection <> "" then do | 
|---|
| 2932 | call _SaveChanges | 
|---|
| 2933 | ok = VRSet("PB_Save", "Enabled", 0) | 
|---|
| 2934 | call CN_smbconf_Click | 
|---|
| 2935 | end | 
|---|
| 2936 | end | 
|---|
| 2937 | IF options.!debug == 1 THEN say 'PB_Save_Click() done' | 
|---|
| 2938 | return | 
|---|
| 2939 |  | 
|---|
| 2940 | /*:VRX         PB_StartStop_Click | 
|---|
| 2941 | */ | 
|---|
| 2942 | PB_StartStop_Click: | 
|---|
| 2943 | call PB_Save_Click | 
|---|
| 2944 | call beep 960, 1 | 
|---|
| 2945 | address CMD samba.!smbcmd' reload' | 
|---|
| 2946 | return | 
|---|
| 2947 |  | 
|---|
| 2948 | /*:VRX         PB_Undo_Click | 
|---|
| 2949 | */ | 
|---|
| 2950 | PB_Undo_Click: | 
|---|
| 2951 | call _SmbConfRestore | 
|---|
| 2952 | SmbConfExists = 1 | 
|---|
| 2953 | call _SmbConfTreeReset | 
|---|
| 2954 | return | 
|---|
| 2955 |  | 
|---|
| 2956 | /*:VRX         PrinterSelection_Close | 
|---|
| 2957 | */ | 
|---|
| 2958 | PrinterSelection_Close: | 
|---|
| 2959 | call PrinterSelection_Fini | 
|---|
| 2960 | return | 
|---|
| 2961 |  | 
|---|
| 2962 | /*:VRX         PrinterSelection_Create | 
|---|
| 2963 | */ | 
|---|
| 2964 | PrinterSelection_Create: | 
|---|
| 2965 | call PrinterSelection_Init | 
|---|
| 2966 | ok = VRMethod( "Application", "ListPrinters", "printer." ) | 
|---|
| 2967 |  | 
|---|
| 2968 | CALL NLVSetText 'Printerselection',     'Caption', 40 | 
|---|
| 2969 | CALL NLVSetText 'PB_Printer_OK',        'Caption',  2 | 
|---|
| 2970 | CALL NLVSetText 'PB_Printer_Abort',     'Caption',  3 | 
|---|
| 2971 |  | 
|---|
| 2972 | do I = 1 to printer.0 | 
|---|
| 2973 | ok = VRMethod("LB_Printers","AddString",PurePrinter(printer.I)) | 
|---|
| 2974 | if PurePrinter(printer.!default) = PurePrinter(printer.I) then ok = VRSet("LB_Printers","Selected",I) | 
|---|
| 2975 | end | 
|---|
| 2976 | return | 
|---|
| 2977 | /*:VRX         PrinterSelection_Fini | 
|---|
| 2978 | */ | 
|---|
| 2979 | PrinterSelection_Fini: | 
|---|
| 2980 | window = VRInfo( "Window" ) | 
|---|
| 2981 | call VRDestroy window | 
|---|
| 2982 | drop window | 
|---|
| 2983 | return | 
|---|
| 2984 | /*:VRX         PrinterSelection_Init | 
|---|
| 2985 | */ | 
|---|
| 2986 | PrinterSelection_Init: | 
|---|
| 2987 | window = VRInfo( "Object" ) | 
|---|
| 2988 | if( \VRIsChildOf( window, "Notebook" ) ) then do | 
|---|
| 2989 | call VRMethod window, "CenterWindow" | 
|---|
| 2990 | call VRSet window, "Visible", 1 | 
|---|
| 2991 | call VRMethod window, "Activate" | 
|---|
| 2992 | end | 
|---|
| 2993 | drop window | 
|---|
| 2994 | return | 
|---|
| 2995 |  | 
|---|
| 2996 | /*:VRX         PurePrinter | 
|---|
| 2997 | */ | 
|---|
| 2998 | PurePrinter: | 
|---|
| 2999 | return substr(arg(1),1,pos(';',arg(1))-1) | 
|---|
| 3000 |  | 
|---|
| 3001 | /*:VRX         Quit | 
|---|
| 3002 | */ | 
|---|
| 3003 | Quit: | 
|---|
| 3004 | IF options.!debug == 1 THEN say "Quit() start" | 
|---|
| 3005 |  | 
|---|
| 3006 | if VRGet("Main","WindowState") = "Maximized"|, | 
|---|
| 3007 | VRGet("Main","WindowState") = "Minimized" then ok = VRMethod("Main", "Restore") | 
|---|
| 3008 |  | 
|---|
| 3009 | if samba.!testparmexe <> "" then do | 
|---|
| 3010 | address cmd samba.!testparmexe' -s 1>'TempDir'smb.conf 2>'TempDir'sscc.testparm' | 
|---|
| 3011 | call _SmbConfCommitChanges | 
|---|
| 3012 | end | 
|---|
| 3013 |  | 
|---|
| 3014 | call _INIWrite | 
|---|
| 3015 | call _SambaFinish | 
|---|
| 3016 | ok = SysFileDelete(TempDir'sscc.testparm') | 
|---|
| 3017 | ok = SysFileDelete(smboutput) | 
|---|
| 3018 |  | 
|---|
| 3019 | IF options.!debug == 1 THEN say "Quit() done" | 
|---|
| 3020 | /* ok = VRRedirectStdio('OFF') */ | 
|---|
| 3021 | window = VRWindow() | 
|---|
| 3022 | call VRSet window, "Shutdown", 1 | 
|---|
| 3023 | drop window | 
|---|
| 3024 | return | 
|---|
| 3025 |  | 
|---|
| 3026 | /*:VRX         RB_PDC_Click | 
|---|
| 3027 | */ | 
|---|
| 3028 | RB_PDC_Click: | 
|---|
| 3029 | CreatePDC = VRGet("RB_PDC","Set") | 
|---|
| 3030 | return | 
|---|
| 3031 |  | 
|---|
| 3032 | /*:VRX         RB_smbpasswd_Click | 
|---|
| 3033 | */ | 
|---|
| 3034 | RB_smbpasswd_Click: | 
|---|
| 3035 | UseTDBsam = 0 | 
|---|
| 3036 | return | 
|---|
| 3037 |  | 
|---|
| 3038 | /*:VRX         RB_Standalone_Click | 
|---|
| 3039 | */ | 
|---|
| 3040 | RB_Standalone_Click: | 
|---|
| 3041 | CreatePDC = \VRGet("RB_Standalone","Set") | 
|---|
| 3042 | return | 
|---|
| 3043 |  | 
|---|
| 3044 | /*:VRX         RB_tdbsam_Click | 
|---|
| 3045 | */ | 
|---|
| 3046 | RB_tdbsam_Click: | 
|---|
| 3047 | UseTDBsam = 1 | 
|---|
| 3048 | return | 
|---|
| 3049 |  | 
|---|
| 3050 | /*:VRX         RemoveConfig_Close | 
|---|
| 3051 | */ | 
|---|
| 3052 | RemoveConfig_Close: | 
|---|
| 3053 | call RemoveConfig_Fini | 
|---|
| 3054 | return | 
|---|
| 3055 |  | 
|---|
| 3056 | /*:VRX         RemoveConfig_Create | 
|---|
| 3057 | */ | 
|---|
| 3058 | RemoveConfig_Create: | 
|---|
| 3059 | call RemoveConfig_Init | 
|---|
| 3060 | CALL NLVSetText 'RemoveConfig',                  'Caption', 90 | 
|---|
| 3061 | CALL NLVSetText 'PB_RemoveContinue',             'Caption', 14 | 
|---|
| 3062 |  | 
|---|
| 3063 | ok = VRset("CB_RemoveSmbConf","Caption", NLVGetMessage(56, 'smb.conf')) | 
|---|
| 3064 | ok = VRset("CB_RemoveBackend","Caption", NLVGetMessage(56, 'Backend')) | 
|---|
| 3065 | ok = VRset("CB_RemoveLMHosts","Caption", NLVGetMessage(56, 'lmhosts')) | 
|---|
| 3066 |  | 
|---|
| 3067 | /* Check if ?db backend files exist */ | 
|---|
| 3068 | ok = SysFileTree(ETC"\samba\*.?db",xdb.,'FOS') | 
|---|
| 3069 | if xdb.0 = 0 then ok = VRset("CB_RemoveBackend","Enabled", 0) | 
|---|
| 3070 |  | 
|---|
| 3071 | /* Check if LMHOsts exists */ | 
|---|
| 3072 | ok = VRset("CB_RemoveLMHosts","Enabled", VRFileExists(ETC'\samba\lmhosts')) | 
|---|
| 3073 | return | 
|---|
| 3074 |  | 
|---|
| 3075 | /*:VRX         RemoveConfig_Fini | 
|---|
| 3076 | */ | 
|---|
| 3077 | RemoveConfig_Fini: | 
|---|
| 3078 | window = VRInfo( "Window" ) | 
|---|
| 3079 | call VRDestroy window | 
|---|
| 3080 | drop window | 
|---|
| 3081 | return | 
|---|
| 3082 | /*:VRX         RemoveConfig_Init | 
|---|
| 3083 | */ | 
|---|
| 3084 | RemoveConfig_Init: | 
|---|
| 3085 | window = VRInfo( "Object" ) | 
|---|
| 3086 | if( \VRIsChildOf( window, "Notebook" ) ) then do | 
|---|
| 3087 | call VRMethod window, "CenterWindow" | 
|---|
| 3088 | call VRSet window, "Visible", 1 | 
|---|
| 3089 | call VRMethod window, "Activate" | 
|---|
| 3090 | end | 
|---|
| 3091 | drop window | 
|---|
| 3092 | return | 
|---|
| 3093 |  | 
|---|
| 3094 | /*:VRX         TM_Installer_Trigger | 
|---|
| 3095 | */ | 
|---|
| 3096 | TM_Installer_Trigger: | 
|---|
| 3097 | call _InstallerMode | 
|---|
| 3098 | return | 
|---|
| 3099 |  | 
|---|
| 3100 | /*:VRX         TM_Value_Trigger | 
|---|
| 3101 | */ | 
|---|
| 3102 | TM_Value_Trigger: | 
|---|
| 3103 | say "TM_Value_Trigger started" | 
|---|
| 3104 | ValueChanged = 0 | 
|---|
| 3105 | ok = VRSet("PB_Save", "Enabled", 0) | 
|---|
| 3106 | ChangeList = "" | 
|---|
| 3107 | ok = VRSet("TM_Value", "Enabled", 0) | 
|---|
| 3108 | say "TM_Value_Trigger done" | 
|---|
| 3109 | return | 
|---|