• 1
  • 5
  • 6
  • 7
  • 8(current)
  • 9
Adding new password dialog to protect share access
a pm from btemp, and my response. i'm posting here so other devs can comment on it:

(btemp @ jan. 29 2005,02:13 Wrote:slacker,

-omitted-

i have a design issue though with adding the samba passwords. i was looking for the best place and it seems that putting most the code in the csmbdirectory::getdirectory function would be optimal. that way, no matter how you got there (video, music, etc), it would run (no need to inject code elsewhere). i can do this ok but as i look into it, i wish i had more info being passed in than just the "path" (i.e., lock mode). of course, the path has the account and password and that was all that was needed for smb before but now i need to prompt if lock mode is 4.

i know i can look this up but it seems to me that the smb path mechanism needs to be revamped now what with lock mode, lock code and not to mention password, path and user name. maybe bookmarks should just be passed around in xbmc as completely contained entities (probably a structure) instead of a path string.

just a thought...

i think the password-setting part can be done within the cguipassword::isitemunlocked function that handles cfileitem objects (don't add it to the function that handles cshare objects, they aren't used for smb-based bookmarks).

you'll want to add a new switch case there for lock_mode_samba, and therein you can just prompt the user to enter a password. then you can take their input and inject it into the cfileitem's path property. if you wanted, you could also check the path to see if the username is specified; if not, you could prompt for that too and inject it into the path. you'll probably need a couple new entries in strings.xml for the prompt dialog headers. then set iresult to 0 in your switch case-- this will cause the function to "unlock" the bookmark and return true. at that point xbmc should try to access the smb share with the credentials you injected.

here's where the tricky part comes in, as you've noticed above--
csmbdirectory::getdirectory does not return the exact error it encounters (it only returns a bool), and way up above in the cgui*base::update functions there isn't even a check to find out if cvirtualdirectory::getdirectory worked-- it's just assumed that it did work. so if it failed, when update(strpath) is called in the cguiwindow*::onclick functions, the user ends up in a blank folder. this needs to be changed so that the getdirectory functions actually return a more descriptive int error (most likely the nt errno), and a bool override created to keep back compat for the other code that call these getdirectory functions. the cgui*base::update functions can be changed from void to returning the value from getdirectory.
then we can check way up in those cguiwindow*::onclick functions to see if update(strpath) worked, and if not, right there we have access to the cfileitem object-- we can flip the lockmode back on for the object and bail out rather than taking the user to an empty folder. it's not a minor change. let me know if you're just dying to do it anyway, otherwise i'll take a crack at it in the next few days.

devs, speak up if there's a better way to do this, if i'm not making sense, or if you think i'm just crazy...
Reply
is there anyway i wonder to setup media, for example r rated (or even x) so there is similar to a parental lock that requires a password to allow them to work?
Image
Reply
harshreality,

i believe this is more for locking xbmc bookmarks and shares....

so that being said, you could probably make a directory with an associated bookmark which is password protected. if you lock everyone out of util programs which could launch the file alternatively then you've effectively locked everyone out.

i assume you wanted something which "noticed" the media was x and thus locked it out...it doesn't work like that today...

i have been waiting for this feature to do a similar thing, i want to lock the kids out of games marked mature. i've seperated games into directories based on their rating and am anxious for this locking to work to lock-out those bookmarks under the "programs" menu.....
Reply
slacker,
good tip about code placement. so far, what you've said to do has worked out except with a little problem with clear() that i'm working on.

...i guess i am dying to work on it. i should have the update in a few days.
btemp
Reply
btemp/slacker/whoever else is listening and cares:

i'm thinking of moving some of the checking out of onclick() and into getdirectory() in all the classes.

this would allow that whenever a directory is read it will check for the password (and prompt user etc.) the fallout would be to go to the root folder (which should be always possible) if the getdirectory() fails for whatever reason.

it also allows kraqh3d's patch (on sf now) to be implemented in a much nicer manner.

any thoughts/comments on this? (ie have i missed something obvious?)

i'm on irc (#xbmc on efnet) most of the time - feel free to pop in and discuss, or send me a pm, or post here etc. etc.

cheers,
jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
can somebody point me on a howto for doing the secure directory as scampa is talking about? i am planning on going to the latest & greatest in the next few days and would like to get it all taken care of at one time (my xbox is in the livingroom & i have to pry it from my childrens cold dead hands) since i have to tote it from the livingroom to my terminal (god will bless me soon with a wireless connection for my x i just know it).
Image
Reply
the info on how to configure it is in the xbmc config file. you basically add a few tags to your defined bookmark...

the issue is that there hasn't been an official build which includes the working version. also, slacker has previously mentioned on this thread how to build a patch, but i have been unsuccessful in my attempts to try this...

slacker is good about responding, i'm sure we'll hear something more definitive soon....i'm waiting for the fix also....
Reply
to enable locking, you first have to turn on the masterlock in xboxmediacenter.xml and set a mastercode of your choice-- this is all detailed in the xml file itself. once this is done, you can also set locks for your various shares and programs bookmarks. locking shares and programs can be done in the xml as documented, but it's way cooler to just use the context menu (white button) in the xbmc program itself to set and manage locks on bookmarks. but the lock stuff won't show up in the context menu until *after* you enable masterlock in the xml. eventually there will be the ability to set up masterlock from somewhere in settings, not sure when this will happen though.
Reply
slacker,

i didn't get that impression when reading the xml file...i guess i didn't follow the connection of the master lock to the bookmark locks since on the bookmarks you set the lock type and lock code....

so i probably misread or am viewing an old copy...i'll check into this....

thx!
Reply
slacker,

is the patch still valid? or have your changes made it into cvs?

-
Reply
slacker,

also....

here are my settings, should these work?
(again, i will need to retry with patch or cvs...i need the updates)

....
<masterlock>
<maxretry>10</maxretry>
<enableshutdown>1</enableshutdown>
<protectshares>1</protectshares>
<mastermode>1</mastermode>
<mastercode>6321</mastercode>
</masterlock>

<myprograms>
<bookmark>
<name>games - mature</name>
<path>f:\games\mature</path>
<lockmode>1</lockmode>
<lockcode>6321</lockcode>
</bookmark>
</myprograms>

....
Reply
all my lock-related patches are in the cvs. if you set up your bookmark locks directly in the xml they'll work without masterlock enabled, but you won't get any ui for managing those locks unless masterlock is enabled. my last patch that went in about a week ago will only show the lock mgmt buttons in the context menu if masterlock is enabled (the ui prompts for masterlock to protect locked bookmark settings).

another thing i added is a prompt to remember masterlock the first time you put it in, and if you say yes, it also asks to override all local bookmark locks. you can use it as a skeleton key to unlock everything just by, for example, editing a locked share's name, entering masterlock, and then saying yes to the next two prompts. then you can just cancel out of editing the name, and all local bookmark locks will be bypassed until you reboot xbmc. it's not very intuitive, but until there is a place in settings to manage masterlock, i don't have a way to make the feature more accessible.

thanks for pointing out that the xml doesn't spell out the fact that masterlock needs to be on. i'll get someone to add a comment about it if i don't submit anything soon. the bottom line for the feature is this: you need to go enable a masterlock in the xml, and then after that, you can set all the bookmark locks you want either in the xml or within xbmc itself. this includes my programs too-- i added a context menu there that lets you create new program bookmarks and set passwords for them.
Reply
slacker,

it works for me! i have not been able to find the "context" menus, or guis for setting the locks (unless i misunderstand you)...

however, i have set all my settings in the xml and it works!!

another question is, when i "cancel" the dialog for entering the unlock code, what view am i shown? when i cancel i notice my view changes, but i am unsure what that view is...should it be the "default" view for a given bookmark?? either way, the functionality i wanted is there....very cool..thank you!!
Reply
to open the context menu, highlight any bookmark (meaning top-level item) and press the white button. you'll get a menu that lets you edit/rename/delete the bookmark, as well as create new bookmarks and lock/reset/remove/relock them too. note that this only works for top level items, once you go into a bookmark the white button does other stuff depending on where you are and what's selected...

ah, i see what you're referring to now. the sort order of the items changes in my programs if you fail to open a bookmark, but the actual "sort by:" button remains unchanged. not sure what's going on there. it looks harmless, but i'm sure it'll eventually get looked at. i also just noticed that setting a full-text password via the context menu is broken-- it lets you put in your new password, but then you never get prompted to confirm the password and the bookmark never gets locked. in the meantime, anyone wanting to use fulltext locks can still do it by setting it in the xml directly...
Reply
also,

any idea what the deal is with the xlink integration in the my programs menu? it must be hardcoded since its not in the config...

i'm guessing here, but i'm assuming there isn't a way to lock (using your additions) that also..(well aside from never adding your password for logging-in in settings)....

either way this may be another place where it would be cool to lock...and a link also appears on the top-level menu for it...so i guess it would entail locating the code for that link and capturing that click...but also making it configurable.....not sure if this already works...just thinking out loud....
Reply
  • 1
  • 5
  • 6
  • 7
  • 8(current)
  • 9

Logout Mark Read Team Forum Stats Members Help
Adding new password dialog to protect share access0