Re: use of net_policy_add_rows_to_policy in pickpolicy
Wes Hardaker <[email protected]> Mon, 26 Apr 2004 15:24:50 -0700
| Newsgroups | gmane.network.net-policy.user |
|---|---|
| Organization | Sparta |
| Message-ID | <[email protected]> |
>>>>> On Mon, 26 Apr 2004 14:53:39 -0700, Lindy Foster <[email protected]> said: Lindy> Wes, in working on changing the initial action to adding to Lindy> roles instead of policy, I noticed in pickpolicy (a sub in Lindy> role_admin) that hte last thing that gets done in the actions Lindy> is net_policy_add_rows_to_policy. But looking at the code, it Lindy> looks like that would only have something to do if Lindy> net_policy_insert had been called prior to that, which doesn't Lindy> seem to be the case. Is that just an old line of code that Lindy> ought to come out anyway, or is there something else going on Lindy> here that I'm missing? History: All configuration modules ask a series of questions and then do a series of inserts into netpolicyconfig.* tables. *each* of these inserts are then also "automagically" copied into appropriate policycontents table entries (which I think is now done entirely by the policychange table). The thing we ran up against a long time ago was that we didn't want to make configuration module writers remember to add the stuff themselves, so we made net_policy_insert (if I recall) *remember* all the IDs for all the rows that it inserted into configuration tables. The old trick was that because the role/policy screens came first, the net_policy_insert functions mere remember stuff to act on and then later when the action clause for pickpolicies got called, it got the list of IDs and inserted them into the policychange table, tying the config row IDs to the policy IDs (which was then actually done when datad ran). This had to be done this way because the policy id wasn't going to be created until after the pickpolicy screen's actions actually created the policy! Wheee... So.... now, if the actions clauses for pickpolicies is getting called first (due to the advent of the -actionsfirst clause), then the policy will actually exist early (since it's created on time) and then net_policy_insert should probably be modified to self-insert into the policychange table. Make sense? Hopefully? -- Wes Hardaker Sparta ------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297