For those interested on this day of horrible crimes being committed with guns, a broad overview of some basics of California gun laws, excerpted from the state Attorney General's Office 2013 document on same.
: joelogon / Foter.com / CC BY-SA: joelogon / Foter.com / CC BY-SA
As I write I do not know what laws were or were not violated in the manner in which the killers obtained whatever weapons they used, but this is an overview of what the law qua law tries to do in California, a state with relatively stringent gun regulations.





The relevant legal environment in which the crimes did occur is in many ways a model for what politicians mean when they talk about "common sense gun safety laws."
California has since 1989 banned a set of long guns it classifies as "assault rifles," see here for details. And "Generally, it is illegal to buy, manufacture, import, keep for sale, expose for sale, give or lend any large-capacity magazine (able to accept more than 10 rounds) in California."
California also has a list of types of specific handgun models that are legal for sale, "available on the DOJ website at http://certguns.doj.ca.gov/," with all others presumptively illegal.
Here are types of people who can't legally obtain guns in California:
Any person convicted of any felony or any offense enumerated in Penal Code section 29905. [A wide variety of violent offenses, including murder, rape, robbery, kidnapping]
• Any person convicted of an offense enumerated in Penal Code section 23515. [anyone who had used a firearm in a violent offense]
• Any person with two or more convictions for violating Penal Code section 417, subdivision (a)(2) [anyone who has waved a gun in a quarrel, essentially, not in self-defense]
• Any person adjudicated to be a mentally disordered sex offender...
• Any person found by a court to be mentally incompetent to stand trial or not guilty by reason of insanity of any crime, unless the court has made a finding of restoration of competence or sanity....
There are a wide variety of shorter-term prohibitions on gun ownership, including 10-year prohibitions for:
Any person convicted of a misdemeanor violation of the following: Penal Code sections 71, 76, 136 .5, 140, 148, subdivision (d), 171b, 171c, 171d, 186 .28, 240, 241, 242, 243, 244 .5, 245, 245 .5, 246, 246 .3, 247, 273 .5, 273 .6, 417, 417 .1, 417 .2, 417 .6, 422, 626 .9, 646 .9, 830 .95, subdivision (a), 17500, 17510, subdivision (a), 25300, 25800, 27510, 27590, subdivision (c), 30315, or 32625, and Welfare and Institutions Code sections 871 .5, 1001 .5, 8100, 8101, or 8103 .
Full copy of penal code here, was unable to provide separate links for every offense above in timely fashion.
And 5-year prohibitions for:
Any person taken into custody as a danger to self or others, assessed, and admitted to a mental health facility under Welfare and Institutions Code sections 5150, 5151, 5152; or certified under Welfare and Institutions Code sections 5250, 5260, 5270 .15 . 
Other prohibitions on legal gun ownership cover people on probation, charged with a felony offense as yet unadjudicated, any voluntary mental patient or under "gravely disabled conservatorship," anyone "addicted to use of narcotics," anyone who threatened a licensed psychotherapist within 6 months, and anyone "under a protective order as defined in Family Code section 6218 or Penal Code section 136.2, or a temporary restraining order issued pursuant to Code of Civil Procedure sections 527.6 or 527.8."
If you are not one of the prohibited, here are some of the laws you face regarding how to obtain a gun as a prospectively legal gun owner:
Only licensed California firearms dealers who possess a valid Certificate of Eligibility (COE) are authorized to engage in retail sales of firearms . These retail sales require the purchaser to provide personal identifier information for the Dealer Record of Sale (DROS) document that the firearms dealer must submit to the DOJ . There is a mandatory 10-day waiting period before the firearms dealer can deliver the firearm to the purchaser ....
Generally, you have to be 18 to get a long gun, 21 for handgun. You must have a state driver's license or I.D. card. And there is no "gun show" or private sale "loophole" in the state:
Generally, it is illegal for any person who is not a California licensed firearms dealer (private party) to sell or transfer a firearm to another non-licensed person (private party) unless the sale is completed through a licensed California firearms dealer . A “Private Party Transfer” (PPT) can be conducted at any licensed California firearms dealership that sells handguns . The buyer and seller must complete the required DROS document in person at the licensed firearms dealership and deliver the firearm to the dealer who will retain possession of the firearm during the mandatory 10-day waiting period .
You can give a gun to a close family member and not go through that process.
You also have to have earned a state-issued "Handgun Safety Certificate" for legal handgun ownership  purchasing, which requires that "you must score at least 75% on an objective written test pertaining to firearms laws and safety requirements," with tests "administered by DOJ Certified Instructors, who are generally located at firearms dealerships. An HSC is valid for five years."
You must also "successfully perform a safe handling demonstration with the handgun being purchased or acquired. Safe handling demonstrations must be performed in the presence of a DOJ Certified Instructor sometime between the date the DROS is submitted to the DOJ and the delivery of the handgun, and are generally performed at the firearms dealership."
In addition, all guns bought in California legally "must be accompanied with a firearms safety device (FSD) that has passed required safety and functionality tests and is listed on the DOJ’s official roster of DOJ-approved firearm safety devices." 
You can only buy one handgun every 30 days by law. You cannot buy a gun for a different person not going through the background check. If you move here with a previously owned weapon, you must inform the state DOJ or get rid of it.
As far as how you can legally use your weapon, here are some restrictions.
You may in general keep it in your own property or business (including temporary residences and campsites) if you legally own it, loaded or unloaded. You can generally legally transport handguns only unloaded and stored in a locked container, which can include your trunk. Long guns must be unloaded while transported.
As of this year, concealed weapons are banned on state schools and universities. As of last year, family members have a legal process to temporarily bar their relatives from getting guns if the family sees the member as unstable.
As far as having your weapon outside your home, business, or property, there are a set of restrictions:
It is illegal for any person to carry a handgun concealed upon his or her person or concealed in a vehicle without a license....The prohibition from carrying a concealed handgun does not apply to licensed hunters or fishermen while engaged in hunting or fishing, or while going to or returning from the hunting expedition. (Pen . Code, § 25640 .)...
It is illegal to carry a loaded firearm on one’s person or in a vehicle while in any public place, on any public street, or in any place where it is unlawful to discharge a firearm .....In order to determine whether a firearm is loaded, peace officers are authorized to examine any firearm carried by anyone on his or her person or in a vehicle while in any public place, on any public street or in any prohibited area of an unincorporated territory. Refusal to allow a peace officer to inspect a firearm pursuant to these provisions is, in itself, grounds for arrest . ....
It is generally illegal for any person to carry upon his or her person or in a vehicle, an exposed and unloaded handgun while in or on: • A public place or public street in an incorporated city or city and county; or • A public street in a prohibited area of an unincorporated city or city and county . ...
Getting that license to carry is up to local authorities, with varying requirements, and is in many areas very difficult to do. Only around 70,000 such licenses exist statewide, with around 29 million adults in the state.
It is legal to use a weapon in self defense under some circumstances:
The killing of one person by another may be justifiable when necessary to resist the attempt to commit a forcible and life-threatening crime, provided that a reasonable person in the same or similar situation would believe that (a) the person killed intended to commit a forcible and life-threatening crime; (b) there was imminent danger of such crime being accomplished; and (c) the person acted under the belief that such force was necessary to save himself or herself or another from death or a forcible and life-threatening crime...
It is lawful for a person being assaulted to defend themself from attack if he or she has reasonable grounds for believing, and does in fact believe, that he or she will suffer bodily injury . In doing so, he or she may use such force, up to deadly force, as a reasonable person in the same or similar circumstances would believe necessary to prevent great bodily injury or death . An assault with fists does not justify use of a deadly weapon in self-defense unless the person being assaulted believes, and a reasonable person in the same or similar circumstances would also believe, that the assault is likely to inflict great bodily injury.
The extent to which this set of laws was relevant either legally or practically to how the weapons used in today's crime were obtained is unknown as I write.